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
variables:
DOCKER_DRIVER: overlay2
GITLAB_CI_USER_NAME: jverhoelen
DOCKER_TAG_FULL_NAME: $CI_REGISTRY/$CI_PROJECT_PATH/my-app:$CI_PIPELINE_ID
cache:
paths:
......@@ -52,15 +52,17 @@ lint-dockerfile:
image: hadolint/hadolint:latest-debian
script:
- hadolint Dockerfile
allow_failure: true
docker-build-and-push:
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:
- IMAGE_TAG=$CI_REGISTRY_IMAGE:latest
- docker login -u $GITLAB_CI_USER_NAME -p ${PRIVATE_ACCESS_TOKEN_JVERHOELEN} ${CI_REGISTRY}
- docker build --disable-content-trust=false -t $IMAGE_TAG .
- docker push $IMAGE_TAG
- docker build --network host --disable-content-trust=false -t $DOCKER_TAG_FULL_NAME .
- docker push $DOCKER_TAG_FULL_NAME
only:
- master
......@@ -7,7 +7,7 @@ COPY ./src ./src
COPY ./public ./public
RUN npm run build
FROM nginx
FROM nginx:1.15
COPY --from=build-deps /usr/src/app/build /usr/share/nginx/html
EXPOSE 80
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