Skip to content

Commit

Permalink
Fix Docker build ARG usage and cleanup base layer packages (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
jippi authored Jan 29, 2025
1 parent c07acf4 commit 4e8c6dd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,9 @@ jobs:
PHP_VERSION=${{ matrix.php_version }}
PHP_BASE_TYPE=${{ matrix.php_base }}
PHP_DEBIAN_RELEASE=${{ matrix.debian_release }}
# Use cache from the last 'main' build to (optimistically) reduce build time in a PR
cache-from: |
type=gha,scope=pixelfed/branch/main/${{ matrix.target_runtime }}-${{ matrix.php_base }}-${{ matrix.php_version }}-${{ matrix.debian_release }}
type=gha,scope=pixelfed/branch/${{ github.ref_name }}/${{ matrix.target_runtime }}-${{ matrix.php_base }}-${{ matrix.php_version }}-${{ matrix.debian_release }}
cache-to: |
type=gha,mode=max,ignore-error=true,scope=pixelfed/branch/${{ github.ref_name }}/${{ matrix.target_runtime }}-${{ matrix.php_base }}-${{ matrix.php_version }}-${{ matrix.debian_release }}
- name: Setup
run: docker/tests/setup.sh
Expand Down
16 changes: 9 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ FROM ghcr.io/jippi/dottie:${DOTTIE_VERSION} AS dottie-image
# It's in its own layer so it can be fetched in parallel with other build steps
FROM alpine/curl AS gomplate-image

ARG GOMPLATE_VERSION
ARG TARGETARCH
ARG TARGETOS
ARG GOMPLATE_VERSION

USER root

Expand All @@ -120,7 +120,7 @@ ENV DEBIAN_FRONTEND="noninteractive"

ARG RUNTIME_GID
ARG RUNTIME_UID
ARG TARGETPLATFORM
ARG TARGETARCH

# Ensure we run all scripts through 'bash' rather than 'sh'
SHELL ["/bin/bash", "-c"]
Expand Down Expand Up @@ -210,10 +210,11 @@ USER ${RUNTIME_UID}:${RUNTIME_GID}
# (e.g.) building the ARM version of Pixelfed on AMD64.
FROM --platform=${BUILDARCH} node:lts AS frontend-build

ARG BUILDARCH
ARG BUILD_FRONTEND=0
ARG RUNTIME_UID
ARG BUILDARCH
ARG RUNTIME_GID
ARG RUNTIME_UID
ARG TARGETARCH

ARG NODE_ENV=production
ENV NODE_ENV=$NODE_ENV
Expand Down Expand Up @@ -256,8 +257,9 @@ EOF
FROM base AS composer-and-src

ARG PHP_VERSION
ARG RUNTIME_UID
ARG RUNTIME_GID
ARG RUNTIME_UID
ARG TARGETARCH

# Install composer dependencies
# NOTE: we skip the autoloader generation here since we don't have all files available (yet)
Expand Down Expand Up @@ -318,7 +320,7 @@ FROM shared-runtime AS apache-runtime

ARG PHP_DEBIAN_RELEASE
ARG PHP_VERSION
ARG TARGETPLATFORM
ARG TARGETARCH

COPY docker/rootfs/apache /

Expand Down Expand Up @@ -348,7 +350,7 @@ ARG NGINX_GPGKEY_PATH
ARG NGINX_VERSION
ARG PHP_DEBIAN_RELEASE
ARG PHP_VERSION
ARG TARGETPLATFORM
ARG TARGETARCH

# Install nginx dependencies
RUN --mount=type=cache,id=pixelfed-apt-lists-${PHP_VERSION}-${PHP_DEBIAN_RELEASE}-${TARGETARCH},sharing=locked,target=/var/lib/apt/lists \
Expand Down
1 change: 1 addition & 0 deletions docker/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ command:
- sqlite3
- standard
- tokenizer
- vips
- xml
- xmlreader
- xmlwriter
Expand Down
5 changes: 2 additions & 3 deletions docker/rootfs/shared/docker/install/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ packages+=(
moreutils
nano
procps
software-properties-common
unzip
wget
tzdata
Expand Down Expand Up @@ -56,8 +55,8 @@ packages+=(
readarray -d ' ' -t -O "${#packages[@]}" packages < <(echo -n "${APT_PACKAGES_EXTRA:-}")

apt-get update
apt-get upgrade -y
apt-get install -y "${packages[@]}"
apt-get upgrade --yes
apt-get install --yes "${packages[@]}"

locale-gen
update-locale

0 comments on commit 4e8c6dd

Please sign in to comment.