mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
ref: simplify Dockerfile stages
This commit is contained in:
parent
c863cf6dc5
commit
acb76e1ab1
43
Dockerfile
43
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 .
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user