Skip to content

Commit

Permalink
Refactor docker config to pass COMPOSER_AUTH during the build
Browse files Browse the repository at this point in the history
  • Loading branch information
botisSmile committed Oct 12, 2023
1 parent 4d1fa8a commit 9482eec
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ jobs:
docker-compose run --rm php composer config repositories.gally-premium composer https://packagist.smile.fr/gally &&
docker-compose run --rm -e COMPOSER_AUTH='$COMPOSER_AUTH' php composer require \"gally/gally-standard:${{ env.composer_version }} as ${{ inputs.last_published_version }}\" &&
docker-compose run --rm -e COMPOSER_AUTH='$COMPOSER_AUTH' php composer require \"gally/gally-premium:${{ env.composer_version }}\" &&
SERVER_NAME=$HOSTNAME APP_SECRET=$APP_SECRET POSTGRES_PASSWORD=$POSTGRES_PASSWORD docker-compose -f docker-compose.yml -f docker-compose.int.yml up -d --build
SERVER_NAME=$HOSTNAME APP_SECRET=$APP_SECRET POSTGRES_PASSWORD=$POSTGRES_PASSWORD COMPOSER_AUTH='$COMPOSER_AUTH' docker-compose -f docker-compose.yml -f docker-compose.int.yml up -d --build
"
3 changes: 3 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ COPY composer.json composer.lock symfony.lock ./
# (for docker-compose version, we need a least on file to exist, so we add the composer.json to prevent failure if packages is missing)
COPY composer.json package* packages/

ARG COMPOSER_AUTH
ENV COMPOSER_AUTH=${COMPOSER_AUTH}

RUN set -eux; \
composer install --prefer-dist --no-dev --no-scripts --no-progress; \
composer clear-cache
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ version: "3.4"
# Production environment override
services:
php:
build:
args:
COMPOSER_AUTH: ${COMPOSER_AUTH}
environment:
APP_ENV: dev # Needed for fixtures bundles to work.
APP_SECRET: ${APP_SECRET}
# MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET}
XDEBUG_MODE: 'off'

caddy:
build:
args:
COMPOSER_AUTH: ${COMPOSER_AUTH}
environment:
EXAMPLE_UPSTREAM: pwa:3000
# MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ services:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-!ChangeMe!}
- POSTGRES_USER=${POSTGRES_USER:-api-platform}
volumes:
- db_data:/var/lib/postgresql/data:rw,z
- db_data:/var/lib/postgresql/data:rw
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./api/docker/db/data:/var/lib/postgresql/data:rw,z

Expand All @@ -132,7 +132,7 @@ services:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" # 512 Mo HEAP
- cluster.routing.allocation.disk.threshold_enabled=false # Avoid ES going read-only because low disk space availability
volumes:
- es_data:/usr/share/elasticsearch/data:rw,z
- es_data:/usr/share/elasticsearch/data:rw
ulimits:
memlock:
soft: -1
Expand Down

0 comments on commit 9482eec

Please sign in to comment.