rest-server/Dockerfile
Jinn Koriech 3a4d901f6d
Docker: build rest-server at container build time
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.
2021-03-28 12:52:33 +01:00

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" ]