diff --git a/Dockerfile b/Dockerfile index 355289e..da2a441 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,15 @@ -# To build locally: docker buildx build . -t wakapi --load - -# Preparation to save some time -FROM --platform=$BUILDPLATFORM golang:1.18-alpine AS prep-env -WORKDIR /src - -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 - -# Build Stage FROM golang:1.18-alpine AS build-env +WORKDIR /src # Required for go-sqlite3 RUN apk add --no-cache gcc musl-dev -WORKDIR /src -COPY --from=prep-env /src . +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 ./go.mod ./go.sum ./ +RUN go mod download +ADD . . RUN go build -v -o wakapi @@ -41,16 +32,16 @@ WORKDIR /app RUN apk add --no-cache bash ca-certificates tzdata # See README.md and config.default.yml for all config options -ENV ENVIRONMENT prod -ENV WAKAPI_DB_TYPE sqlite3 -ENV WAKAPI_DB_USER '' -ENV WAKAPI_DB_PASSWORD '' -ENV WAKAPI_DB_HOST '' -ENV WAKAPI_DB_NAME=/data/wakapi.db -ENV WAKAPI_PASSWORD_SALT '' -ENV WAKAPI_LISTEN_IPV4 '0.0.0.0' -ENV WAKAPI_INSECURE_COOKIES 'true' -ENV WAKAPI_ALLOW_SIGNUP 'true' +ENV ENVIRONMENT=prod \ + WAKAPI_DB_TYPE=sqlite3 \ + WAKAPI_DB_USER='' \ + WAKAPI_DB_PASSWORD='' \ + WAKAPI_DB_HOST='' \ + WAKAPI_DB_NAME=/data/wakapi.db \ + WAKAPI_PASSWORD_SALT='' \ + WAKAPI_LISTEN_IPV4='0.0.0.0' \ + WAKAPI_INSECURE_COOKIES='true' \ + WAKAPI_ALLOW_SIGNUP='true' COPY --from=build-env /app .