1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

perf: separate download stage in Dockerfile

This commit is contained in:
Steven Tang 2022-01-03 12:01:29 +11:00
parent bf7f93fcd4
commit b66f9b5cf5
No known key found for this signature in database
GPG Key ID: AA0C5A4496B7ADF5

View File

@ -1,19 +1,26 @@
# Build Stage
# To build locally: docker buildx build . -t wakapi --load
FROM golang:1.16-alpine AS build-env
# Preparation to save some time
FROM --platform=$BUILDPLATFORM golang:1.16-alpine AS prep-env
WORKDIR /src
# Required for go-sqlite3
RUN apk add --no-cache gcc musl-dev
ADD ./go.mod .
RUN go mod download
ADD . .
RUN wget "https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh" -O wait-for-it.sh && \
chmod +x wait-for-it.sh
ADD . .
RUN go build -o wakapi
# Build Stage
FROM golang:1.16-alpine AS build-env
# Required for go-sqlite3
RUN apk add --no-cache gcc musl-dev
WORKDIR /src
COPY --from=prep-env /src .
RUN go build -v -o wakapi
WORKDIR /app
RUN cp /src/wakapi . && \