Skip to content

Commit b8c8232

Browse files
committed
Fix build args
1 parent ed22dcf commit b8c8232

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

.github/workflows/branch.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ jobs:
8282
needs: validate
8383
steps:
8484
- uses: actions/checkout@v4
85+
- name: Set environment variables
86+
run: |
87+
if [[ "${{ github.ref_name }}" == "alpha" ]]; then
88+
echo "APP_ENV=dev" >> $GITHUB_ENV
89+
echo "DATABASE_URL=mysql://root:symfony@db-branch:3306/symfony" >> $GITHUB_ENV
90+
else
91+
echo "APP_ENV=prod" >> $GITHUB_ENV
92+
echo "DATABASE_URL=mysql://root:symfony@db-branch:3306/symfony" >> $GITHUB_ENV
93+
fi
8594
- name: Login to registry
8695
uses: docker/login-action@v3
8796
with:
@@ -94,6 +103,9 @@ jobs:
94103
context: .
95104
push: true
96105
tags: ${{ secrets.DOCKER_REGISTRY }}/api-php:${{ github.ref_name }}
106+
build-args: |
107+
APP_ENV=${{ env.APP_ENV }}
108+
DATABASE_URL=${{ env.DATABASE_URL }}
97109
- name: Configure SSH
98110
run: |
99111
mkdir -p ~/.ssh/

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ FROM registry.realtoken.community/docker-symfony-php:8.4
33
WORKDIR /var/www/html
44
COPY . ./
55

6-
# Composer install sans .env
7-
RUN composer install --prefer-dist --no-interaction --optimize-autoloader --no-progress
8-
9-
#ARG APP_ENV=prod
6+
ARG APP_ENV=prod
7+
ARG DATABASE_URL
108
ENV APP_ENV=${APP_ENV}
9+
ENV DATABASE_URL=${DATABASE_URL}
10+
11+
RUN composer install --prefer-dist --no-interaction --optimize-autoloader --no-progress
1112
RUN composer dump-env ${APP_ENV}
1213
RUN composer run-script --no-dev post-install-cmd
1314

docker-compose-branch.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ services:
66
context: ./
77
args:
88
APP_ENV: ${APP_ENV}
9+
DATABASE_URL: ${DATABASE_URL}
10+
environment:
11+
APP_ENV: ${APP_ENV}
12+
DATABASE_URL: ${DATABASE_URL}
913
networks:
1014
- api-${DOCKER_BRANCH}
1115
- traefik-realt

0 commit comments

Comments
 (0)