DodoTransfer/Dockerfile
2026-11-05 10:28:10 +09:00

53 lines
1.5 KiB
Docker

# Frontend assets are platform independent: build them once on the native
# build platform instead of under QEMU for every target architecture
FROM --platform=$BUILDPLATFORM node:26-alpine AS frontend
WORKDIR /build/app
COPY app/package.json app/package-lock.json ./
RUN npm ci
COPY app ./
# writes to /build/public/app (see app/vite.config.js)
RUN npm run build
FROM node:26-alpine
ENV PSITRANSFER_UPLOAD_DIR=/data \
NODE_ENV=production
LABEL org.opencontainers.image.title="Dodo Transfer" \
org.opencontainers.image.description="Self-hosted file transfer" \
org.opencontainers.image.source="https://git.dodo-lab.kr/blue2rai/DodoTransfer" \
org.opencontainers.image.licenses="BSD-2-Clause"
RUN apk add --no-cache tzdata
WORKDIR /app
# Backend deps include native prebuilds (argon2), install for the target platform
COPY package.json package-lock.json ./
RUN npm ci --omit=dev && \
npm cache clean --force && \
mkdir /data && \
chown node /data
COPY *.js README.md LICENSE ./
COPY lib lib
COPY lang lang
COPY plugins plugins
COPY public public
COPY --from=frontend /build/public/app public/app
EXPOSE 3000
VOLUME ["/data"]
USER node
# /healthz needs no login. Port and base url follow the environment settings.
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD sh -c 'b="${PSITRANSFER_BASE_URL:-/}"; case "$b" in */) ;; *) b="$b/";; esac; wget -q -O /dev/null "http://127.0.0.1:${PSITRANSFER_PORT:-3000}${b}healthz"'
CMD ["node", "app.js"]