Skip to content

Commit cfe39b7

Browse files
committed
Enhance github action workflow
- Add database image build and export steps - Refine environment variable syntax in PHP Dockerfile
1 parent 61d8e28 commit cfe39b7

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

.github/workflows/docker-publish.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
env:
1111
REGISTRY: ghcr.io
1212
IMAGE_NAME: tsdsystem-app
13+
IMAGE_DB_NAME: tsdsystem-db
1314
IMAGE_TAG: latest
1415

1516
jobs:
@@ -43,14 +44,22 @@ jobs:
4344
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
4445
fi
4546
46-
- name: Build and export to Docker
47+
- name: Build TSDSystem app and export to Docker
4748
uses: docker/build-push-action@v6
4849
with:
4950
context: .
5051
file: ./docker/php/Dockerfile.prod
5152
load: true
5253
tags: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
5354

55+
- name: Build TSDSystem db and export to Docker
56+
uses: docker/build-push-action@v6
57+
with:
58+
context: .
59+
file: ./docker/timescale/Dockerfile
60+
load: true
61+
tags: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_DB_NAME }}:${{ env.IMAGE_TAG }}
62+
5463
- name: Test Run
5564
run: |
5665
docker run --rm -d ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
@@ -64,3 +73,16 @@ jobs:
6473
tags: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
6574
cache-from: type=gha
6675
cache-to: type=gha,mode=max
76+
77+
- name: Build and push db image
78+
uses: docker/build-push-action@v6
79+
with:
80+
context: .
81+
file: ./docker/timescale/Dockerfile
82+
push: true
83+
tags: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_DB_NAME }}:${{ env.IMAGE_TAG }}
84+
cache-from: type=gha
85+
cache-to: type=gha,mode=max
86+
87+
- name: Logout from Docker Registry
88+
run: docker logout ${{ env.REGISTRY }}

docker/php/Dockerfile.prod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN apt-get update \
1212

1313
RUN docker-php-ext-install pdo pdo_pgsql pgsql
1414

15-
# ENABLE mod rewrite
15+
# ENABLE mod rewrite
1616
RUN a2enmod rewrite
1717

1818
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
@@ -23,9 +23,9 @@ WORKDIR /var/www/html/tsdws
2323

2424
# Configure non-root user.
2525
ARG PUID=1000
26-
ENV PUID ${PUID}
26+
ENV PUID=${PUID}
2727
ARG PGID=1000
28-
ENV PGID ${PGID}
28+
ENV PGID=${PGID}
2929

3030
RUN groupmod -o -g ${PGID} www-data && \
3131
usermod -o -u ${PUID} -g www-data www-data

0 commit comments

Comments
 (0)