diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e65c60669f18a896d6a3e3ad7f6a336cae88b143..1289fcd90bbf0350b27303cfa2c573d5890c7aef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,13 +36,13 @@ run-tests: # image: node:16.17.0-alpine services: - name: docker:${DOCKER_VERSION}-dind - alias: containerHost + alias: containerhost script: - docker run -p 27017:27017 -d --name mongo-container --rm mongo:${MONGO_VERSION} - docker build --tag "${CONTAINER_TAG}-test" --target=test - --add-host=host.docker.internal:containerHost + --add-host=host.docker.internal:172.17.0.1 "./app" # - echo ‘http://dl-cdn.alpinelinux.org/alpine/v3.6/main’ >> /etc/apk/repositories # - echo ‘http://dl-cdn.alpinelinux.org/alpine/v3.6/community’ >> /etc/apk/repositories diff --git a/app/Dockerfile b/app/Dockerfile index eb268203186a49ef22b913b9166cad17bb113c64..459a5c7b6fc8bc97edc9cedcc786441c22e76f34 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -5,10 +5,6 @@ ARG NODEJS_VERSION='16.17.0' FROM node:$NODEJS_VERSION-alpine AS base -ARG \ - MONGODB_URL_TEST=mongodb://host.docker.internal:27017/todo-app \ - JWT_SECRET_TEST=<my-very-secret-jwt> - ENV \ PORT=<dynamically-set-from-k8s> \ MONGODB_URL=<dynamically-set-from-k8s> \ @@ -37,8 +33,8 @@ COPY ./server/package*.json ./ RUN npm ci --no-audit --no-fund ARG \ - MONGODB_URL_TEST \ - JWT_SECRET_TEST + MONGODB_URL_TEST=mongodb://host.docker.internal:27017/todo-app \ + JWT_SECRET_TEST=<my-very-secret-jwt> # MONGODB_URL and JWT_SECRET are available as env variables RUN MONGODB_URL=$MONGODB_URL_TEST JWT_SECRET=$JWT_SECRET_TEST npm run test