mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 15:43:21 +00:00
Use multi-stage build for Docker
This commit is contained in:
parent
10dc7a4a86
commit
d7db672c01
1 changed files with 13 additions and 6 deletions
19
Dockerfile
19
Dockerfile
|
@ -1,16 +1,23 @@
|
||||||
FROM alpine
|
FROM golang:alpine3.13 AS builder
|
||||||
|
LABEL stage=builder
|
||||||
|
WORKDIR /workspace
|
||||||
|
COPY . .
|
||||||
|
RUN CGO_ENABLED=0 go build -o rest-server ./cmd/rest-server
|
||||||
|
|
||||||
|
|
||||||
|
FROM alpine:3.13 AS final
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
ENV DATA_DIRECTORY /data
|
ENV DATA_DIRECTORY /data
|
||||||
ENV PASSWORD_FILE /data/.htpasswd
|
ENV PASSWORD_FILE /data/.htpasswd
|
||||||
|
ENV PATH="/app:${PATH}"
|
||||||
|
|
||||||
RUN apk add --no-cache --update apache2-utils
|
RUN apk add --no-cache --update apache2-utils
|
||||||
|
|
||||||
COPY docker/create_user /usr/bin/
|
COPY docker/. .
|
||||||
COPY docker/delete_user /usr/bin/
|
COPY --from=builder /workspace/rest-server .
|
||||||
COPY docker/entrypoint.sh /entrypoint.sh
|
|
||||||
COPY rest-server /usr/bin
|
|
||||||
|
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
CMD [ "/entrypoint.sh" ]
|
CMD [ "./entrypoint.sh" ]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue