Browse Source

Add optional build stage

dev
chapeau 2 years ago
parent
commit
0fc6b5f966
  1. 20
      .gitlab-ci.yml
  2. 4
      docker/Dockerfile-nginx

20
.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:

4
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

Loading…
Cancel
Save