Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ jobs:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v4.2.2

- name: Compute version metadata
id: version
run: |
echo "revision=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
echo "timestamp=$(git log -n 1 --format=%ct)" >> "$GITHUB_OUTPUT"

- name: Log in to GitHub Container Registry
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # tag=v3.4.0
with:
Expand All @@ -96,6 +102,9 @@ jobs:
context: .
target: bewelcome_php
platforms: ${{ matrix.platform }}
build-args: |
APP_VERSION=${{ steps.version.outputs.revision }}
APP_VERSION_TIMESTAMP=${{ steps.version.outputs.timestamp }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ RUN set -eux; \
# Self-contained production image.
FROM bewelcome_php_base AS bewelcome_php

ARG APP_VERSION=unknown
ARG APP_VERSION_TIMESTAMP=

ENV APP_ENV=prod

COPY --from=bewelcome_source /srv/bewelcome/bin bin/
Expand All @@ -149,6 +152,8 @@ COPY --from=bewelcome_assets /srv/bewelcome/public/build public/build/
COPY --from=bewelcome_assets /srv/bewelcome/public/main.js /srv/bewelcome/public/service-worker.js public/

RUN set -eux; \
printf '%s\n' "$APP_VERSION" > VERSION; \
if [ -n "$APP_VERSION_TIMESTAMP" ]; then php -r 'touch("VERSION", (int) $argv[1]);' "$APP_VERSION_TIMESTAMP"; fi; \
mkdir -p var/cache var/log data/user/avatars data/gallery/member upload/images public/bundles /config /data; \
find public -name '*.map' -type f -delete; \
chown -R www-data:www-data var data upload public/bundles /config /data; \
Expand Down
Loading