mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 15:43:21 +00:00

Using docker's multi-stage builds we can build the restic/rest-server within a golang build environment then create a container for use (without the build environment) in a second build stage. The advantages are: 1. Building the rest-server is predictable in a pristine environment each time. 2. Container builds ensure we get the latest rest-server every time. Updated README with details of new docker build approach, and added changelog for unreleased changes.
27 lines
458 B
Docker
27 lines
458 B
Docker
FROM golang:alpine AS builder
|
|
|
|
ENV CGO_ENABLED 0
|
|
|
|
COPY . /build
|
|
WORKDIR /build
|
|
RUN go build -o rest-server ./cmd/rest-server
|
|
|
|
|
|
|
|
|
|
FROM alpine
|
|
|
|
ENV DATA_DIRECTORY /data
|
|
ENV PASSWORD_FILE /data/.htpasswd
|
|
|
|
RUN apk add --no-cache --update apache2-utils
|
|
|
|
COPY docker/create_user /usr/bin/
|
|
COPY docker/delete_user /usr/bin/
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
COPY --from=builder /build/rest-server /usr/bin
|
|
|
|
VOLUME /data
|
|
EXPOSE 8000
|
|
|
|
CMD [ "/entrypoint.sh" ]
|