-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
-
First Check
- I added a very descriptive title here.
- I used the GitHub search to find a similar question and didn't find it.
- I searched in the documentation/README.
- I already searched in Google "How to do X" and didn't find any information.
- I already read and followed all the tutorial in the docs/README and didn't find an answer.
Commit to Help
- I commit to help with one of those options 👆
Description
I am going to use this project template with Gitlab. Will post my implementation here, anybody else did this already or has some ideas? we could collect them here :-)
Tests
Add a test script to the scripts folder, this is from the "old" project template
scripts/test-gitlab-ci.sh
#! /usr/bin/env sh # Exit in case of error set -e DOMAIN=backend \ SMTP_HOST="" \ TRAEFIK_PUBLIC_NETWORK_IS_EXTERNAL=false \ INSTALL_DEV=true \ docker compose \ -f docker-compose.yml \ config > docker-stack.yml docker compose -f docker-stack.yml build docker compose -f docker-stack.yml down -v --remove-orphans # Remove possibly previous broken stacks left hanging after an error docker compose -f docker-stack.yml up -d docker compose -f docker-stack.yml exec -T backend bash /app/tests-start.sh "$@" docker compose -f docker-stack.yml down -v --remove-orphans
In docker-compose.yml
, we substitute the fixed value for networks:traefik-public:external
with a variable TRAEFIK_PUBLIC_NETWORK_IS_EXTERNAL
networks: traefik-public: # Allow setting it to false for testing external: ${TRAEFIK_PUBLIC_NETWORK_IS_EXTERNAL-true}
In the test stage of the .gitlab-ci.yml
we call the test script:
tests: stage: test script: - sh ./scripts/test-gitlab-ci.sh tags: - test
We also have to modify a line the docker file backend/Dockerfile
to make sure we have the contents of the scripts
folder available in the container under /app/scripts
from
COPY ./scripts/ /app/
to
COPY ./scripts /app/scripts
Build
The build works out of the box, this is the build stage in my .gitlab-ci.yml
build-prod: stage: build script: - TAG=prod FRONTEND_ENV=production sh ./scripts/build-push.sh only: - main tags: - build
Operating System
Linux
Operating System Details
Irrelevant
Python Version
3.10
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1