From e7af0485fb22fc9d283fcbda81578f59b6cd55e4 Mon Sep 17 00:00:00 2001 From: Sivan Duijn <sivanduijn@gmail.com> Date: Mon, 28 Mar 2022 14:25:46 +0200 Subject: [PATCH] feat(pipeline): update gitlab ci and dockerfile --- .dockerignore | 1 + .gitlab-ci.yml | 38 +++++++++++++++++++++++++++++++++----- Dockerfile | 19 +++++++++---------- 3 files changed, 43 insertions(+), 15 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..b512c09d4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e35789def..80257ff41 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: node:16-alpine stages: - setup - test + - build install-dependencies: stage: setup @@ -33,14 +34,41 @@ install-dependencies: paths: - node_modules/.cache/nx -build: +test: stage: test extends: .distributed script: - - yarn nx affected --base=HEAD~1 --target=build --parallel --max-parallel=3 + - yarn nx affected --base=HEAD~1 --target=test --parallel --max-parallel=2 -test: +build: stage: test - extends: .distributed + only: + - main + needs: + - install-dependencies + artifacts: + paths: + - node_modules/.cache/nx + - dist/apps/web-graphpolaris script: - - yarn nx affected --base=HEAD~1 --target=test --parallel --max-parallel=2 + # - yarn nx affected --base=HEAD~1 --target=build --parallel --max-parallel=3 + # only build web-graphpolaris + - yarn nx build web-graphpolaris --prod + +build-docker: + image: docker:stable + stage: dockerize + tags: + - docker + only: + - develop + - debug + script: + - docker build --progress plain -t $CI_PROJECT_NAME-webserver-service:latest . + # after_script: + # - docker login datastropheregistry.azurecr.io -u $REGISTRY_USERNAME -p $REGISTRY_PASSWORD + # - if [[ ! -z $CI_COMMIT_BRANCH+x ]]; then DOCKER_TAG=$CI_COMMIT_BRANCH; else DOCKER_TAG=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME; fi + # - docker tag $CI_PROJECT_NAME-webserver-service datastropheregistry.azurecr.io/$CI_PROJECT_NAME-webserver-service:$DOCKER_TAG + # - docker push datastropheregistry.azurecr.io/$CI_PROJECT_NAME-webserver-service:$DOCKER_TAG + dependencies: + - build diff --git a/Dockerfile b/Dockerfile index 5ae50ee3a..39c702414 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,12 @@ -# # Prepare nginx -# FROM nginx:1.19-alpine -# WORKDIR /app +# Prepare nginx +FROM nginx:1.19-alpine +WORKDIR /app -# # ! This copy source needs to be changed to reflect the actual app name -# COPY ./dist/apps/frontend /usr/share/nginx/html +COPY ./dist/apps/web-graphpolaris /usr/share/nginx/html -# RUN rm /etc/nginx/conf.d/default.conf -# COPY nginx/nginx.conf /etc/nginx/conf.d +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx/nginx.conf /etc/nginx/conf.d -# # Fire up nginx -# EXPOSE 80 -# CMD ["nginx", "-g", "daemon off;"] +# Fire up nginx +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] -- GitLab