~gsthnz/satellite

36439f7c1ed24f80f93f8801536c7e1ba1585001 — Timur Demin 3 years ago 35ff8ae
Add Docker build support

This adds a Dockerfile and a short instruction on how to use it to run
Satellite. Since the Makefile requires scdoc to be installed (which is
not present in golang:1.15), the Dockerfile runs go build manually
instead.
2 files changed, 51 insertions(+), 0 deletions(-)

A Dockerfile
M README.md
A Dockerfile => Dockerfile +24 -0
@@ 0,0 1,24 @@
FROM golang:1.15 AS builder

WORKDIR /app
COPY . /app

ENV CGO_ENABLED=0
RUN \
   go mod download -x && \
   go build -v -o /tmp/satellite .

FROM alpine:3.12 AS worker

WORKDIR /app
VOLUME /config
VOLUME /data

RUN adduser -D -u 1000 satellite && \
    mkdir -p /config && chown satellite /config && chmod 700 /config && \
    mkdir -p /data && chown satellite /data && chmod 700 /data

COPY --from=builder /tmp/satellite /app/satellite

USER satellite
CMD ["/app/satellite", "-c", "/config/config.toml"]

M README.md => README.md +27 -0
@@ 51,6 51,33 @@ This will install a sample configuration on
`/usr/local/share/satellite/satellite.toml` that you can later copy to
`/etc/satellite.toml`.

## Running with Docker

Build an image:

```
$ docker build -t satellite .
```

Create two directories to store certs/configuration and data served by
satellite (Satellite runs under UID 1000, so we need to grant it RWX on the
config dir), then run the container:

```
$ mkdir config
$ mkdir data
$ cat >config/satellite.toml <<EOF
[tls]
directory = "/config"
[[domain]]
name = "example.org"
root = "/data"
EOF
$ chown 1000 config
$ chmod 700 config
$ docker run -d -p 1965:1965 -v $(pwd)/config:/config -v $(pwd)/data:/data satellite
```

## Contributing
Patches and questions? Send to my [public
inbox](https://lists.sr.ht/~gsthnz/public-inbox):