From f77ba0d4f1caa1bc7aabb86c0528cf589eba5bcc Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 9 Feb 2024 13:41:34 +0100 Subject: [PATCH] feat: only one dockerfile with api and frontend --- .dockerignore | 5 +++++ Dockerfile | 22 +++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index 7c3e21f74..fe8d3f15d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,3 +7,8 @@ docker-manifest.tmpl docker-manifest-unstable.tmpl *.db *.zip + +# Frontend +/frontend/node_modules/ +/frontend/.direnv +/frontend/dist diff --git a/Dockerfile b/Dockerfile index c1f6a0332..1a00257d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,27 @@ # syntax=docker/dockerfile:1 -# ┬─┐┬ ┐o┬ ┬─┐ -# │─││ │││ │ │ -# ┘─┘┘─┘┘┘─┘┘─┘ +FROM --platform=$BUILDPLATFORM node:20.11.0-alpine AS frontendbuilder -FROM --platform=$BUILDPLATFORM techknowlogick/xgo:go-1.21.x AS builder +WORKDIR /build + +ARG USE_RELEASE=false +ARG RELEASE_VERSION=unstable +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 @@ -41,4 +53,4 @@ RUN apk --update --no-cache add tzdata tini shadow && \ COPY docker/entrypoint.sh /entrypoint.sh RUN chmod 0755 /entrypoint.sh && mkdir files -COPY --from=builder /build/vikunja-* vikunja +COPY --from=apibuilder /build/vikunja-* vikunja