2022-03-12 16:22:41 +01:00
|
|
|
FROM golang:1.17.8-alpine AS builder
|
2022-03-13 20:18:07 +01:00
|
|
|
ARG APIURL
|
2022-03-12 16:22:41 +01:00
|
|
|
WORKDIR /project
|
|
|
|
ADD . /project/
|
|
|
|
RUN go mod tidy
|
2022-05-14 20:45:28 +02:00
|
|
|
RUN GOARCH=wasm GOOS=js go build -o web/app.wasm -ldflags="-X 'main.ApiURL=$APIURL'" ./src
|
|
|
|
RUN go build -o app -ldflags="-X 'main.ApiURL=$APIURL'" ./src
|
2022-03-12 16:22:41 +01:00
|
|
|
|
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:37:32 +01:00
|
|
|
ENV TESTING true
|
2022-03-13 19:34:20 +01:00
|
|
|
CMD ["./app"]
|