Created
January 28, 2022 13:04
-
-
Save Sampriti-Mitra/501d2997c947ea5e7327b72bf09a29cd to your computer and use it in GitHub Desktop.
This file contains 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
# Build the Go API | |
FROM golang:latest AS builder | |
ADD . /app | |
WORKDIR /app/server | |
RUN go mod download | |
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-w" -a -o /main . | |
# Build the React application | |
FROM node:alpine AS node_builder | |
COPY --from=builder /app/frontend ./ | |
RUN npm install | |
RUN npm run build | |
# Final stage build, this will be the container | |
# that we will deploy to production | |
FROM alpine:latest | |
RUN apk --no-cache add ca-certificates | |
COPY --from=builder /main ./ | |
COPY --from=node_builder /build ./web | |
RUN chmod +x ./main | |
EXPOSE 8080 | |
CMD ./main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment