mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 15:43:21 +00:00
Merge pull request #145 from jinnko/master
Build restic at container build time
This commit is contained in:
commit
a44c025cd3
3 changed files with 26 additions and 2 deletions
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
|
FROM alpine
|
||||||
|
|
||||||
ENV DATA_DIRECTORY /data
|
ENV DATA_DIRECTORY /data
|
||||||
|
@ -8,7 +19,7 @@ RUN apk add --no-cache --update apache2-utils
|
||||||
COPY docker/create_user /usr/bin/
|
COPY docker/create_user /usr/bin/
|
||||||
COPY docker/delete_user /usr/bin/
|
COPY docker/delete_user /usr/bin/
|
||||||
COPY docker/entrypoint.sh /entrypoint.sh
|
COPY docker/entrypoint.sh /entrypoint.sh
|
||||||
COPY rest-server /usr/bin
|
COPY --from=builder /build/rest-server /usr/bin
|
||||||
|
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
|
@ -19,11 +19,15 @@ The required version of restic backup client to use with `rest-server` is [v0.7.
|
||||||
|
|
||||||
For building the `rest-server` binary run `CGO_ENABLED=0 go build -o rest-server ./cmd/rest-server`
|
For building the `rest-server` binary run `CGO_ENABLED=0 go build -o rest-server ./cmd/rest-server`
|
||||||
|
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
### Build image
|
### Build image
|
||||||
|
|
||||||
Put the `rest-server` binary in the current directory, then run:
|
The docker image build process will build a fresh version of the rest-server and package that into
|
||||||
|
a usable container.
|
||||||
|
|
||||||
|
To build the binary along with the container run:
|
||||||
|
|
||||||
docker build -t restic/rest-server:latest .
|
docker build -t restic/rest-server:latest .
|
||||||
|
|
||||||
|
@ -32,6 +36,7 @@ Put the `rest-server` binary in the current directory, then run:
|
||||||
|
|
||||||
docker pull restic/rest-server
|
docker pull restic/rest-server
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
To learn how to use restic backup client with REST backend, please consult [restic manual](https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#rest-server).
|
To learn how to use restic backup client with REST backend, please consult [restic manual](https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#rest-server).
|
||||||
|
|
8
changelog/unreleased/issue-146
Normal file
8
changelog/unreleased/issue-146
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
Change: Build rest-server at docker container build time
|
||||||
|
|
||||||
|
Add a build stage such that the latest rest-server is always built and packaged.
|
||||||
|
This is done in a standard golang container to ensure a clean build environment
|
||||||
|
and only the final binary is shipped rather than the whole build environment.
|
||||||
|
|
||||||
|
https://github.com/restic/rest-server/issues/146
|
||||||
|
https://github.com/restic/rest-server/pull/145
|
Loading…
Add table
Add a link
Reference in a new issue