diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..b512c09d476623ff4bf8d0d63c29b784925dbdf8 --- /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 e35789def0cfe075414a549041e95c960b8a2c40..fcd29fb2b81f387e1003bf0b46a9969be2fa2650 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,8 @@ image: node:16-alpine stages: - setup - test + - build + - dockerize install-dependencies: stage: setup @@ -33,14 +35,40 @@ install-dependencies: paths: - node_modules/.cache/nx -build: - stage: test - extends: .distributed - script: - - yarn nx affected --base=HEAD~1 --target=build --parallel --max-parallel=3 - test: stage: test extends: .distributed script: - yarn nx affected --base=HEAD~1 --target=test --parallel --max-parallel=2 + +build: + stage: build + only: + - main + needs: + - install-dependencies + artifacts: + paths: + - node_modules/.cache/nx + - dist/apps/web-graphpolaris + script: + # - 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: + - main + 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 5ae50ee3abb63bbc32251cc96e7094c28d330d66..39c70241463b4eebd6f935ad20eb0dbee962c535 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;"]