Skip to content

Commit

Permalink
build: adjust docker build to pass the frontend artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
masl committed Mar 24, 2024
1 parent c88f0cd commit 1e13e95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
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

FROM alpine:3 AS final

WORKDIR /app
COPY --from=build /build/undershorts .
COPY --from=build /build/web ./web

CMD [ "/app/undershorts" ]

0 comments on commit 1e13e95

Please sign in to comment.