CI test for separate fe and be builds
This commit is contained in:
Родитель
72818161ec
Коммит
4fcfd56664
|
@ -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
|
|
@ -27,6 +27,13 @@ workflows:
|
|||
only: /^v.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
test-separation:
|
||||
jobs:
|
||||
- test_sep_build:
|
||||
context: main-builds
|
||||
filters:
|
||||
branches:
|
||||
only: cristi/fe-be-separation
|
||||
|
||||
jobs:
|
||||
test_server:
|
||||
|
@ -76,3 +83,22 @@ jobs:
|
|||
name: Create and Deploy Docker image
|
||||
no_output_timeout: 30m
|
||||
command: ./.circleci/ci-build-and-deploy.sh
|
||||
|
||||
test_sep_build:
|
||||
docker:
|
||||
- image: circleci/golang:1.15
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker:
|
||||
docker_layer_caching: true
|
||||
- run:
|
||||
name: Install kubectl
|
||||
command: |
|
||||
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
|
||||
chmod u+x ./kubectl
|
||||
- run:
|
||||
name: Build and Deploy Frontend
|
||||
command: env SPECKLE_SERVER_PACKAGE=frontend ./.circleci/build-and-deploy.sh
|
||||
- run:
|
||||
name: Build and Deploy Server
|
||||
command: env SPECKLE_SERVER_PACKAGE=server ./.circleci/build-and-deploy.sh
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
.circleci
|
||||
.git
|
||||
**/node_modules
|
||||
**/dist
|
||||
test-queries
|
||||
|
@ -10,4 +11,4 @@ lerna.json
|
|||
.env.example
|
||||
.eslintrc.json
|
||||
.mocharc.js
|
||||
readme.md
|
||||
readme.md
|
||||
|
|
|
@ -6,6 +6,7 @@ packages/viewer/dist
|
|||
.nyc_output
|
||||
coverage/
|
||||
.vscode
|
||||
.idea
|
||||
test-queries
|
||||
|
||||
**/.DS_Store
|
||||
|
|
|
@ -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;"]
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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"]
|
Загрузка…
Ссылка в новой задаче