mirror of
https://github.com/restic/rest-server.git
synced 2025-12-06 17:15:45 -08:00
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.
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -1,3 +1,14 @@
|
||||
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
|
||||
@@ -8,7 +19,7 @@ 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 rest-server /usr/bin
|
||||
COPY --from=builder /build/rest-server /usr/bin
|
||||
|
||||
VOLUME /data
|
||||
EXPOSE 8000
|
||||
|
||||
Reference in New Issue
Block a user