|
|
|
|
@ -8,9 +8,9 @@ ARG TARGETPLATFORM=${TARGETPLATFORM}
|
|
|
|
|
ARG BUILDPLATFORM=${BUILDPLATFORM}
|
|
|
|
|
ARG BASE_REGISTRY="docker.io"
|
|
|
|
|
|
|
|
|
|
# Node version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="20"]
|
|
|
|
|
# Node version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="22"]
|
|
|
|
|
# renovate: datasource=node-version depName=node
|
|
|
|
|
ARG NODE_MAJOR_VERSION="22"
|
|
|
|
|
ARG NODE_MAJOR_VERSION="24"
|
|
|
|
|
# Debian image to use for base image, change with [--build-arg DEBIAN_VERSION="trixie"]
|
|
|
|
|
ARG DEBIAN_VERSION="trixie"
|
|
|
|
|
# Node image to use for base image based on combined variables (ex: 20-trixie-slim)
|
|
|
|
|
@ -32,20 +32,20 @@ ARG GID="991"
|
|
|
|
|
|
|
|
|
|
# Apply Mastodon build options based on options above
|
|
|
|
|
ENV \
|
|
|
|
|
# Apply Mastodon version information
|
|
|
|
|
# Apply Mastodon version information
|
|
|
|
|
MASTODON_VERSION_PRERELEASE="${MASTODON_VERSION_PRERELEASE}" \
|
|
|
|
|
MASTODON_VERSION_METADATA="${MASTODON_VERSION_METADATA}" \
|
|
|
|
|
# Apply timezone
|
|
|
|
|
# Apply timezone
|
|
|
|
|
TZ=${TZ}
|
|
|
|
|
|
|
|
|
|
ENV \
|
|
|
|
|
# Configure the IP to bind Mastodon to when serving traffic
|
|
|
|
|
# Configure the IP to bind Mastodon to when serving traffic
|
|
|
|
|
BIND="0.0.0.0" \
|
|
|
|
|
# Explicitly set PORT to match the exposed port
|
|
|
|
|
# Explicitly set PORT to match the exposed port
|
|
|
|
|
PORT=4000 \
|
|
|
|
|
# Use production settings for Yarn, Node and related nodejs based tools
|
|
|
|
|
# Use production settings for Yarn, Node and related nodejs based tools
|
|
|
|
|
NODE_ENV="production" \
|
|
|
|
|
# Add Ruby and Mastodon installation to the PATH
|
|
|
|
|
# Add Ruby and Mastodon installation to the PATH
|
|
|
|
|
DEBIAN_FRONTEND="noninteractive"
|
|
|
|
|
|
|
|
|
|
# Set default shell used for running commands
|
|
|
|
|
@ -56,29 +56,29 @@ ARG TARGETPLATFORM
|
|
|
|
|
RUN echo "Target platform is ${TARGETPLATFORM}"
|
|
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
|
# Remove automatic apt cache Docker cleanup scripts
|
|
|
|
|
# Remove automatic apt cache Docker cleanup scripts
|
|
|
|
|
rm -f /etc/apt/apt.conf.d/docker-clean; \
|
|
|
|
|
# Sets timezone
|
|
|
|
|
# Sets timezone
|
|
|
|
|
echo "${TZ}" > /etc/localtime; \
|
|
|
|
|
# Creates mastodon user/group and sets home directory
|
|
|
|
|
# Creates mastodon user/group and sets home directory
|
|
|
|
|
groupadd -g "${GID}" mastodon; \
|
|
|
|
|
useradd -l -u "${UID}" -g "${GID}" -m -d /opt/mastodon mastodon; \
|
|
|
|
|
# Creates symlink for /mastodon folder
|
|
|
|
|
# Creates symlink for /mastodon folder
|
|
|
|
|
ln -s /opt/mastodon /mastodon;
|
|
|
|
|
|
|
|
|
|
# hadolint ignore=DL3008,DL3005
|
|
|
|
|
RUN \
|
|
|
|
|
# Mount Apt cache and lib directories from Docker buildx caches
|
|
|
|
|
--mount=type=cache,id=apt-cache-${TARGETPLATFORM},target=/var/cache/apt,sharing=locked \
|
|
|
|
|
--mount=type=cache,id=apt-lib-${TARGETPLATFORM},target=/var/lib/apt,sharing=locked \
|
|
|
|
|
# Upgrade to check for security updates to Debian image
|
|
|
|
|
# Mount Apt cache and lib directories from Docker buildx caches
|
|
|
|
|
--mount=type=cache,id=apt-cache-${TARGETPLATFORM},target=/var/cache/apt,sharing=locked \
|
|
|
|
|
--mount=type=cache,id=apt-lib-${TARGETPLATFORM},target=/var/lib/apt,sharing=locked \
|
|
|
|
|
# Upgrade to check for security updates to Debian image
|
|
|
|
|
apt-get update; \
|
|
|
|
|
apt-get dist-upgrade -yq; \
|
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
|
ca-certificates \
|
|
|
|
|
curl \
|
|
|
|
|
tzdata \
|
|
|
|
|
wget \
|
|
|
|
|
ca-certificates \
|
|
|
|
|
curl \
|
|
|
|
|
tzdata \
|
|
|
|
|
wget \
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
# Set /opt/mastodon as working directory
|
|
|
|
|
@ -91,19 +91,19 @@ COPY .yarn /opt/mastodon/.yarn
|
|
|
|
|
COPY ./streaming /opt/mastodon/streaming
|
|
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
|
# Mount local Corepack and Yarn caches from Docker buildx caches
|
|
|
|
|
--mount=type=cache,id=corepack-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/corepack,sharing=locked \
|
|
|
|
|
--mount=type=cache,id=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \
|
|
|
|
|
# Mount local Corepack and Yarn caches from Docker buildx caches
|
|
|
|
|
--mount=type=cache,id=corepack-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/corepack,sharing=locked \
|
|
|
|
|
--mount=type=cache,id=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \
|
|
|
|
|
# Configure Corepack
|
|
|
|
|
rm /usr/local/bin/yarn*; \
|
|
|
|
|
corepack enable; \
|
|
|
|
|
corepack prepare --activate;
|
|
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
|
# Mount Corepack and Yarn caches from Docker buildx caches
|
|
|
|
|
--mount=type=cache,id=corepack-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/corepack,sharing=locked \
|
|
|
|
|
--mount=type=cache,id=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \
|
|
|
|
|
# Install Node packages
|
|
|
|
|
# Mount Corepack and Yarn caches from Docker buildx caches
|
|
|
|
|
--mount=type=cache,id=corepack-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/corepack,sharing=locked \
|
|
|
|
|
--mount=type=cache,id=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \
|
|
|
|
|
# Install Node packages
|
|
|
|
|
yarn workspaces focus --production @mastodon/streaming;
|
|
|
|
|
|
|
|
|
|
# Set the running user for resulting container
|
|
|
|
|
|