
This change modifies the docker image so that it uses the scratch image instead of alpine. This is possible because the Vikunja binary is now entirely statically compiled, wich no dependencies on any system c libraries. This also changes the default path for the sqlite file in the docker image (breaking). When using sqlite in docker, the VIKUNJA_DATABASE_PATH config variable or the file mount must be changed to prevent data loss.
47 lines
1.2 KiB
Docker
47 lines
1.2 KiB
Docker
# syntax=docker/dockerfile:1
|
|
FROM --platform=$BUILDPLATFORM node:20.11.0-alpine AS frontendbuilder
|
|
|
|
WORKDIR /build
|
|
|
|
ENV PNPM_CACHE_FOLDER .cache/pnpm/
|
|
ENV PUPPETEER_SKIP_DOWNLOAD true
|
|
|
|
COPY frontend/ ./
|
|
|
|
RUN corepack enable && \
|
|
pnpm install && \
|
|
pnpm run build
|
|
|
|
FROM --platform=$BUILDPLATFORM techknowlogick/xgo:go-1.21.x AS apibuilder
|
|
|
|
RUN go install github.com/magefile/mage@latest && \
|
|
mv /go/bin/mage /usr/local/go/bin
|
|
|
|
WORKDIR /go/src/code.vikunja.io/api
|
|
COPY . ./
|
|
COPY --from=frontendbuilder /build/dist ./frontend/dist
|
|
|
|
ARG TARGETOS TARGETARCH TARGETVARIANT
|
|
|
|
ENV GOPROXY https://goproxy.kolaente.de
|
|
RUN export PATH=$PATH:$GOPATH/bin && \
|
|
mage build:clean && \
|
|
mage release:xgo "${TARGETOS}/${TARGETARCH}/${TARGETVARIANT}"
|
|
|
|
# ┬─┐┬ ┐┌┐┐┌┐┐┬─┐┬─┐
|
|
# │┬┘│ │││││││├─ │┬┘
|
|
# ┘└┘┘─┘┘└┘┘└┘┴─┘┘└┘
|
|
|
|
# The actual image
|
|
FROM scratch
|
|
LABEL maintainer="maintainers@vikunja.io"
|
|
WORKDIR /app/vikunja
|
|
ENTRYPOINT [ "/app/vikunja/vikunja" ]
|
|
EXPOSE 3456
|
|
USER 1000
|
|
|
|
ENV VIKUNJA_SERVICE_ROOTPATH=/app/vikunja/
|
|
ENV VIKUNJA_DATABASE_PATH=/db/vikunja.db
|
|
|
|
COPY --from=apibuilder /build/vikunja-* vikunja
|