81 lines
2.6 KiB
Docker
81 lines
2.6 KiB
Docker
# IMPORTANT:
|
|
#
|
|
# This container has no user isolation and is designed specifically for use with Podman and ideally protected by a MAC (SELinux, AppArmor, etc).
|
|
#
|
|
# For general Docker usage, please make sure use the official Dockerfile instead.
|
|
|
|
ARG NODE_VERSION=22.11.0-bookworm
|
|
|
|
FROM rust:1-bookworm AS rust-builder
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -yqq --no-install-recommends \
|
|
build-essential libcap-ng-dev libapparmor-dev
|
|
|
|
COPY ./yume-mods /yume-mods
|
|
|
|
WORKDIR /yume-mods
|
|
|
|
ARG ENTRYPOINT_FEATURES=""
|
|
|
|
RUN cargo build -p misskey-auto-deploy-entrypoint --release --features "${ENTRYPOINT_FEATURES}"
|
|
|
|
FROM node:${NODE_VERSION} AS builder
|
|
|
|
ENV COREPACK_DEFAULT_TO_LATEST=0
|
|
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
rm -f /etc/apt/apt.conf.d/docker-clean \
|
|
; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \
|
|
&& apt-get update \
|
|
&& apt-get install -yqq --no-install-recommends \
|
|
build-essential
|
|
|
|
RUN corepack enable
|
|
|
|
WORKDIR /misskey
|
|
|
|
ENV COREPACK_DEFAULT_TO_LATEST=0
|
|
|
|
COPY . ./
|
|
|
|
RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \
|
|
pnpm i --frozen-lockfile --aggregate-output
|
|
|
|
RUN git submodule update --init
|
|
RUN pnpm build
|
|
RUN rm -rf .git/
|
|
RUN chmod -R -w /misskey
|
|
|
|
FROM --platform=$TARGETPLATFORM node:${NODE_VERSION}-slim AS runner
|
|
|
|
ENV COREPACK_DEFAULT_TO_LATEST=0
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
ffmpeg curl libjemalloc-dev libjemalloc2 libcap-ng0 libapparmor1 \
|
|
&& ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so \
|
|
&& corepack enable \
|
|
&& mkdir -p /misskey \
|
|
&& find / -type d -path /sys -prune -o -type d -path /proc -prune -o -type f -perm /u+s -ignore_readdir_race -exec chmod u-s {} \; \
|
|
&& find / -type d -path /sys -prune -o -type d -path /proc -prune -o -type f -perm /g+s -ignore_readdir_race -exec chmod g-s {} \; \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists
|
|
|
|
WORKDIR /misskey
|
|
|
|
# add package.json to add pnpm
|
|
COPY ./package.json ./package.json
|
|
RUN corepack install
|
|
|
|
COPY --from=rust-builder --chown=0:0 --chmod=755 /yume-mods/target/release/misskey-auto-deploy-entrypoint /usr/local/bin/misskey-auto-deploy-entrypoint
|
|
COPY --from=builder --chown=0:0 /misskey/ ./
|
|
|
|
ENV LD_PRELOAD=/usr/local/lib/libjemalloc.so
|
|
ARG NODE_ENV=production
|
|
ENV NODE_ENV=${NODE_ENV}
|
|
HEALTHCHECK --interval=10s --timeout=10s --retries=3 \
|
|
CMD [":healthcheck"]
|
|
ENTRYPOINT ["/usr/local/bin/misskey-auto-deploy-entrypoint"]
|
|
CMD ["/usr/local/bin/pnpm", "run", "migrateandstart"]
|