Browse Source

Merge pull request #233 from turt2live/travis/docker

Update Docker instructions to be more automated-build friendly
hs/remove-rss-url-metric
Jan Christian Grünhage 6 years ago
committed by GitHub
parent
commit
a9279d4a49
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .dockerignore
  2. 3
      .gitignore
  3. 30
      Dockerfile
  4. 7
      README.md
  5. 12
      build-docker-image.sh
  6. 1
      docker/root/etc/s6.d/.s6-svscan/finish
  7. 2
      docker/root/etc/s6.d/go-neb/finish
  8. 3
      docker/root/etc/s6.d/go-neb/run

6
.dockerignore

@ -0,0 +1,6 @@
vendor/pkg
vendor/src
pkg
hooks
bin
.git

3
.gitignore

@ -12,6 +12,9 @@ bin
pkg
_obj
_test
.idea
vendor/pkg
vendor/src
# Architecture specific extensions/prefixes
*.[568vq]

30
Dockerfile

@ -1,10 +1,32 @@
FROM alpine:3.6
# Build go-neb
FROM golang:1.10-alpine as builder
ENV BIND_ADDRESS=:4050 DATABASE_TYPE=sqlite3 DATABASE_URL=/data/go-neb.db?_busy_timeout=5000
COPY . /tmp/go-neb
WORKDIR /tmp/go-neb
RUN apk add --no-cache -t build-deps git gcc musl-dev go \
&& go get -u github.com/constabulary/gb/... \
&& gb vendor restore \
&& gb build -f github.com/matrix-org/go-neb
COPY bin/go-neb /go-neb
# Run go-neb
FROM alpine:3.7
ENV BIND_ADDRESS=:4050 \
DATABASE_TYPE=sqlite3 \
DATABASE_URL=/data/go-neb.db?_busy_timeout=5000 \
UID=1337 \
GID=1337
COPY --from=builder /tmp/go-neb/bin/go-neb /usr/local/bin/go-neb
RUN apk add --no-cache \
ca-certificates \
su-exec \
s6
VOLUME /data
EXPOSE 4050
ENTRYPOINT ["/go-neb"]
COPY docker/root /
ENTRYPOINT ["/bin/s6-svscan", "/etc/s6.d/"]

7
README.md

@ -225,7 +225,12 @@ sensible-browser http://localhost:6060/pkg/github.com/matrix-org/go-neb
## Docker image
There is a `Dockerfile` in the root of the repository and a `build-docker-image.sh` script that uses an alpine-based golang container to build `go-neb` (note that this will overwrite host-built binaries in `pkg/` and `bin/`) and then builds the docker image using that binary.
To get started quickly, use the image from docker.io:
```
docker run -v /path/to/data:/data -e "BASE_URL=http://your.public.url:4050" matrixdotorg/go-neb
```
If you'd prefer to build the file yourself, clone this repository and build the `Dockerfile`.
The image sets the following environment variables:
```

12
build-docker-image.sh

@ -1,12 +0,0 @@
#!/bin/bash
set -e
docker run \
--rm \
-v "$PWD":/usr/src/myapp \
-w /usr/src/myapp \
golang:1.8-alpine \
sh -c 'apk add --no-cache git gcc musl-dev && go get -u github.com/constabulary/gb/... && gb build -f github.com/matrix-org/go-neb'
docker build -t ${IMAGE_PREFIX}go-neb:latest .

1
docker/root/etc/s6.d/.s6-svscan/finish

@ -0,0 +1 @@
#!/bin/sh

2
docker/root/etc/s6.d/go-neb/finish

@ -0,0 +1,2 @@
#!/bin/sh
s6-svscanctl -t /etc/s6.d

3
docker/root/etc/s6.d/go-neb/run

@ -0,0 +1,3 @@
#!/bin/sh
chown -R ${UID}:${GID} /data
exec su-exec ${UID}:${GID} /usr/local/bin/go-neb
Loading…
Cancel
Save