2022-03-12 16:22:41 +01:00
|
|
|
FROM golang:1.17.8-alpine AS builder
|
|
|
|
WORKDIR /project
|
|
|
|
ADD . /project/
|
|
|
|
RUN go mod tidy
|
|
|
|
RUN GOARCH=wasm GOOS=js go build -o web/app.wasm
|
|
|
|
RUN go build -o app
|
|
|
|
|
2022-03-13 19:34:20 +01:00
|
|
|
FROM alpine:latest AS staging
|
2022-03-12 16:22:41 +01:00
|
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
WORKDIR /root/
|
|
|
|
COPY --from=builder /project/web ./web/
|
|
|
|
COPY --from=builder /project/app ./
|
|
|
|
EXPOSE 8000
|
2022-03-13 19:34:20 +01:00
|
|
|
ENV TESTING = true
|
2022-03-12 16:22:41 +01:00
|
|
|
CMD ["./app"]
|
|
|
|
|
2022-03-13 19:34:20 +01:00
|
|
|
FROM alpine:latest AS production
|
|
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
WORKDIR /root/
|
|
|
|
COPY --from=builder /project/web ./web/
|
|
|
|
COPY --from=builder /project/app ./
|
|
|
|
EXPOSE 8000
|
|
|
|
ENV TESTING = false
|
|
|
|
CMD ["./app"]
|