mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
don't build the frontend by default in Docker
This commit is contained in:
parent
8a35eb0b7e
commit
d5470101f4
2 changed files with 25 additions and 5 deletions
|
@ -1122,6 +1122,13 @@ DOCKER_APP_HOST_CACHE_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH:?error}/pixelfed/ca
|
||||||
# @dottie/validate required,oneof=0 1 2
|
# @dottie/validate required,oneof=0 1 2
|
||||||
#DOCKER_APP_PHP_OPCACHE_REVALIDATE_FREQ="2"
|
#DOCKER_APP_PHP_OPCACHE_REVALIDATE_FREQ="2"
|
||||||
|
|
||||||
|
# When doing [docker compose build], should the frontend be built in the Dockerfile?
|
||||||
|
# If set to "0" the included pre-compiled frontend will be used.
|
||||||
|
#
|
||||||
|
# @default "0"
|
||||||
|
# @dottie/validate required,oneof=0 1
|
||||||
|
#DOCKER_APP_BUILD_FRONTEND="0"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# docker redis
|
# docker redis
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
23
Dockerfile
23
Dockerfile
|
@ -188,6 +188,7 @@ RUN --mount=type=cache,id=pixelfed-pear-${PHP_VERSION}-${PHP_DEBIAN_RELEASE}-${T
|
||||||
FROM --platform=${BUILDARCH} node:lts AS frontend-build
|
FROM --platform=${BUILDARCH} node:lts AS frontend-build
|
||||||
|
|
||||||
ARG BUILDARCH
|
ARG BUILDARCH
|
||||||
|
ARG BUILD_FRONTEND=0
|
||||||
ARG RUNTIME_UID
|
ARG RUNTIME_UID
|
||||||
|
|
||||||
ARG NODE_ENV=production
|
ARG NODE_ENV=production
|
||||||
|
@ -199,16 +200,28 @@ WORKDIR /var/www/
|
||||||
RUN --mount=type=cache,id=pixelfed-node-${BUILDARCH},sharing=locked,target=/tmp/cache \
|
RUN --mount=type=cache,id=pixelfed-node-${BUILDARCH},sharing=locked,target=/tmp/cache \
|
||||||
--mount=type=bind,source=package.json,target=/var/www/package.json \
|
--mount=type=bind,source=package.json,target=/var/www/package.json \
|
||||||
--mount=type=bind,source=package-lock.json,target=/var/www/package-lock.json \
|
--mount=type=bind,source=package-lock.json,target=/var/www/package-lock.json \
|
||||||
npm install \
|
<<EOF bash
|
||||||
--cache /tmp/cache \
|
if [[ $BUILD_FRONTEND -eq 1 ]]; then
|
||||||
--no-save \
|
npm install \
|
||||||
--dev
|
--cache /tmp/cache \
|
||||||
|
--no-save \
|
||||||
|
--dev
|
||||||
|
else
|
||||||
|
echo "Skipping [npm install] as --build-arg [BUILD_FRONTEND] is not set to '1'"
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
|
||||||
# Copy the frontend source into the image before building
|
# Copy the frontend source into the image before building
|
||||||
COPY --chown=${RUNTIME_UID}:${RUNTIME_GID} . /var/www
|
COPY --chown=${RUNTIME_UID}:${RUNTIME_GID} . /var/www
|
||||||
|
|
||||||
# Build the frontend with "mix" (See package.json)
|
# Build the frontend with "mix" (See package.json)
|
||||||
RUN npm run production
|
RUN <<EOF bash
|
||||||
|
if [[ $BUILD_FRONTEND -eq 1 ]]; then
|
||||||
|
npm run production
|
||||||
|
else
|
||||||
|
echo "Skipping [npm run production] as --build-arg [BUILD_FRONTEND] is not set to '1'"
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
|
||||||
#######################################################
|
#######################################################
|
||||||
# PHP: composer and source code
|
# PHP: composer and source code
|
||||||
|
|
Loading…
Reference in a new issue