Last active
September 21, 2023 23:11
-
-
Save arshamalh/42cdd40b5abb3de1c9c61534e17914bc to your computer and use it in GitHub Desktop.
Go and UI Multistage Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.21-alpine3.18 AS builder | |
WORKDIR /app | |
COPY go.mod go.sum ./ | |
RUN go mod download | |
COPY . ./ | |
RUN CGO_ENABLED=0 GOOS=linux go build -a -o main . | |
FROM node:18-alpine3.15 AS frontend | |
WORKDIR /ui | |
COPY ui . | |
RUN npm install | |
RUN npm run build | |
FROM alpine:3.18 AS production | |
COPY --from=builder /app/main . | |
COPY --from=frontend /ui/public /ui | |
CMD ["./main"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment