Commit df56b3c4 authored by Jonas Verhoelen's avatar Jonas Verhoelen

improved dockerfile. improved usage of docker build according to our gitlab CI instace

parent 865759f5
Pipeline #33931 passed with stages
in 6 minutes and 48 seconds
...@@ -2,7 +2,7 @@ image: node:8.12.0 ...@@ -2,7 +2,7 @@ image: node:8.12.0
variables: variables:
DOCKER_DRIVER: overlay2 DOCKER_DRIVER: overlay2
GITLAB_CI_USER_NAME: jverhoelen DOCKER_TAG_FULL_NAME: $CI_REGISTRY/$CI_PROJECT_PATH/my-app:$CI_PIPELINE_ID
cache: cache:
paths: paths:
...@@ -52,15 +52,17 @@ lint-dockerfile: ...@@ -52,15 +52,17 @@ lint-dockerfile:
image: hadolint/hadolint:latest-debian image: hadolint/hadolint:latest-debian
script: script:
- hadolint Dockerfile - hadolint Dockerfile
allow_failure: true
docker-build-and-push: docker-build-and-push:
stage: dockerize stage: dockerize
image: gitlab/dind image: docker:latest
tags:
- privileged
before_script:
- docker version
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
- IMAGE_TAG=$CI_REGISTRY_IMAGE:latest - docker build --network host --disable-content-trust=false -t $DOCKER_TAG_FULL_NAME .
- docker login -u $GITLAB_CI_USER_NAME -p ${PRIVATE_ACCESS_TOKEN_JVERHOELEN} ${CI_REGISTRY} - docker push $DOCKER_TAG_FULL_NAME
- docker build --disable-content-trust=false -t $IMAGE_TAG .
- docker push $IMAGE_TAG
only: only:
- master - master
...@@ -7,7 +7,7 @@ COPY ./src ./src ...@@ -7,7 +7,7 @@ COPY ./src ./src
COPY ./public ./public COPY ./public ./public
RUN npm run build RUN npm run build
FROM nginx FROM nginx:1.15
COPY --from=build-deps /usr/src/app/build /usr/share/nginx/html COPY --from=build-deps /usr/src/app/build /usr/share/nginx/html
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment