Skip to content
Snippets Groups Projects
Commit 8178b1a3 authored by Dobromir Palushev's avatar Dobromir Palushev
Browse files

Merge branch 'staging' into 'main'

Deployment from main

See merge request !45
parents 543f826e b67868a8
No related branches found
No related tags found
1 merge request!45Deployment from main
Pipeline #19173 passed
......@@ -15,7 +15,7 @@ variables:
CONTAINER_TAG: '${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}'
stages:
# - test
- test
- build
- release
- deploy
......@@ -36,6 +36,9 @@ run-tests:
services:
- name: docker:${DOCKER_VERSION}-dind
alias: localhost
variables:
MONGODB_URL_TEST: mongodb://localhost:27017/todo-app
JWT_SECRET_TEST: my-very-secret-jwt
script:
- docker run -p 27017:27017
--detach
......@@ -45,11 +48,10 @@ run-tests:
mongo:${MONGO_VERSION}
- docker build
--tag "${CONTAINER_TAG}-test"
--target=test
--network=host
--build-arg MONGODB_URL_TEST=mongodb://localhost:27017/todo-app
--build-arg JWT_SECRET_TEST=my-very-secret-jwt
--add-host=host.docker.internal:localhost
--build-arg MONGODB_URL_TEST=$MONGODB_URL_TEST
--build-arg JWT_SECRET_TEST=$JWT_SECRET_TEST
--file "./app/Dockerfile.test"
"./app"
after_script:
- docker stop mongo-container
......
......@@ -14,35 +14,6 @@ ENV \
MONGODB_URL=<dynamically-set-from-k8s> \
JWT_SECRET=<dynamically-set-from-k8s>
# ------------------------------------------------------------------
# # Test stage
# FROM base AS test
# # client tests
# WORKDIR /client
# COPY ./client .
# RUN npm ci --no-audit --no-fund
# RUN npm run test
# # server tests
# WORKDIR /server
# COPY ./server/src ./src/
# COPY ./server/package*.json ./
# RUN npm ci --no-audit --no-fund
# ARG MONGODB_URL_TEST
# ARG JWT_SECRET_TEST
# # MONGODB_URL and JWT_SECRET are available as env variables
# RUN MONGODB_URL=$MONGODB_URL_TEST JWT_SECRET=$JWT_SECRET_TEST npm run test
# ------------------------------------------------------------------
# Build stage
FROM base AS build
......
ARG NODEJS_VERSION='16.17.0'
# Test stage
FROM node:$NODEJS_VERSION-alpine
# client tests
WORKDIR /client
COPY ./client .
RUN npm ci --no-audit --no-fund
RUN npm run test
# server tests
WORKDIR /server
COPY ./server/src ./src/
COPY ./server/package*.json ./
RUN npm ci --no-audit --no-fund
ARG \
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment