-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI test for separate fe and be builds
- Loading branch information
Showing
7 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
TARGET_SPECKLE_DEPLOYMENT=$SPECKLE_K8S_DEPLOYMENT-$SPECKLE_SERVER_PACKAGE | ||
IMAGE_VERSION_TAG=$CIRCLE_SHA1 | ||
|
||
DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG-$SPECKLE_SERVER_PACKAGE | ||
|
||
if [[ "$CIRCLE_TAG" =~ ^v.* ]]; then | ||
TARGET_SPECKLE_DEPLOYMENT=$SPECKLE_K8S_DEPLOYMENT_PROD-$SPECKLE_SERVER_PACKAGE | ||
IMAGE_VERSION_TAG=$CIRCLE_TAG | ||
fi | ||
|
||
docker build -t $DOCKER_IMAGE_TAG:latest . -f packages/$SPECKLE_SERVER_PACKAGE/Dockerfile | ||
docker tag $DOCKER_IMAGE_TAG:latest $DOCKER_IMAGE_TAG:$IMAGE_VERSION_TAG | ||
|
||
echo "$DOCKER_REG_PASS" | docker login -u "$DOCKER_REG_USER" --password-stdin $DOCKER_REG_URL | ||
docker push $DOCKER_IMAGE_TAG:latest | ||
docker push $DOCKER_IMAGE_TAG:$IMAGE_VERSION_TAG | ||
|
||
# echo "$K8S_CLUSTER_CERTIFICATE" | base64 --decode > k8s_cert.crt | ||
|
||
|
||
#./kubectl \ | ||
# --kubeconfig=/dev/null \ | ||
# --server=$K8S_SERVER \ | ||
# --certificate-authority=k8s_cert.crt \ | ||
# --token=$K8S_TOKEN \ | ||
# set image deployment/$TARGET_SPECKLE_DEPLOYMENT main=$DOCKER_IMAGE_TAG:$IMAGE_VERSION_TAG | ||
|
||
#./kubectl \ | ||
# --kubeconfig=/dev/null \ | ||
# --server=$K8S_SERVER \ | ||
# --certificate-authority=k8s_cert.crt \ | ||
# --token=$K8S_TOKEN \ | ||
# rollout status -w deployment/$TARGET_SPECKLE_DEPLOYMENT --timeout=1m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ packages/viewer/dist | |
.nyc_output | ||
coverage/ | ||
.vscode | ||
.idea | ||
test-queries | ||
|
||
**/.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# NOTE: Docker context should be set to git root directory, to include the viewer | ||
|
||
# build stage | ||
FROM node:14.16-buster-slim as build-stage | ||
|
||
WORKDIR /opt/viewer | ||
COPY packages/viewer/package*.json ./ | ||
RUN npm install | ||
COPY packages/viewer . | ||
RUN npm run build | ||
|
||
WORKDIR /opt/frontend | ||
COPY packages/frontend/package*.json ./ | ||
RUN npm install ../viewer | ||
RUN npm ci | ||
COPY packages/frontend . | ||
RUN npm run build | ||
|
||
|
||
# production stage | ||
FROM nginx:stable-alpine as production-stage | ||
COPY --from=build-stage /opt/frontend/dist /usr/share/nginx/html | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
COPY packages/frontend/nginx/nginx.conf /etc/nginx/conf.d | ||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
server { | ||
listen 80; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
try_files $uri $uri/ /app.html; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
|
||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM node:14.16.0-buster-slim as node | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
tini \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENV NODE_ENV=production | ||
WORKDIR /app | ||
|
||
COPY packages/server/package*.json . | ||
RUN npm ci | ||
|
||
COPY packages/server . | ||
|
||
ENTRYPOINT [ "tini", "--" ] | ||
CMD ["node", "bin/www"] |