From 1e13e953293b554938f99eea9c0ca36b5a2f27f0 Mon Sep 17 00:00:00 2001 From: masl Date: Sun, 24 Mar 2024 13:52:02 +0100 Subject: [PATCH] build: adjust docker build to pass the frontend artifacts --- .github/workflows/build.yml | 2 +- Dockerfile | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a1e59f..3779744 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.21.2 + go-version: 1.22.1 - name: Install dependencies run: go mod download diff --git a/Dockerfile b/Dockerfile index 9887bb9..4f2181f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,18 @@ +FROM node:20-alpine AS web-build + +WORKDIR /build +COPY ./web/package.json . +RUN npm install +COPY ./web . +RUN npm run build + FROM golang:1.22.1-alpine AS build WORKDIR /build +# TODO: exclude web files using --exclude when available in stable syntax +# https://docs.docker.com/reference/dockerfile/#copy---exclude COPY . . +COPY --from=web-build /build/dist ./web/dist RUN go mod download RUN go build -o undershorts ./cmd/undershorts/main.go @@ -9,5 +20,5 @@ FROM alpine:3 AS final WORKDIR /app COPY --from=build /build/undershorts . -COPY --from=build /build/web ./web + CMD [ "/app/undershorts" ]