From 0fc6b5f966d70d27369c2cac909513aedae5aaac Mon Sep 17 00:00:00 2001 From: chapeau Date: Sun, 10 Mar 2024 12:21:29 +0100 Subject: [PATCH] Add optional build stage --- .gitlab-ci.yml | 20 +++++++++++--------- docker/Dockerfile-nginx | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 899ab12d..967d2478 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,22 +5,24 @@ variables: stages: - lint - build + - test build: image: docker:24.0.5 services: - docker:24.0.5-dind + rules: + - if: '$CI_COMMIT_BRANCH == "dev"' stage: build - variables: - POSTGRES_DB: postgres - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - SUPERUSER_LOGIN: admin - SUPERUSER_PASS: admin - SUPERUSER_EMAIL: admin@example.net - ENV: dev script: - # - docker build -t re2o . --target=postgres + - docker compose build + +test: + image: docker:24.0.5 + services: + - docker:24.0.5-dind + stage: test + script: - docker compose -f docker-compose-dev.yml run --env RUN_TESTS=yes re2o lint: diff --git a/docker/Dockerfile-nginx b/docker/Dockerfile-nginx index d95e40dd..3b76657d 100644 --- a/docker/Dockerfile-nginx +++ b/docker/Dockerfile-nginx @@ -5,8 +5,8 @@ WORKDIR /code RUN apt-get update && apt-get install -y --no-install-recommends gettext-base gettext libpq-dev COPY . /code/ RUN poetry install --extras "postgresql" -RUN ENV=dev DATABASE_URL='' poetry run python manage.py collectstatic --noinput -RUN poetry run python manage.py compilemessages +ENV POSTGRES_DB=postgres POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres SUPERUSER_LOGIN=admin SUPERUSER_PASS=admin SUPERUSER_EMAIL=admin@example.net ENV=dev +RUN poetry run python manage.py collectstatic --noinput FROM nginx COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf