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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
47 additions and
17 deletions
.dockerignore
.gitignore
Dockerfile
README.md
build-docker-image.sh
docker/root/etc/s6.d/.s6-svscan/finish
docker/root/etc/s6.d/go-neb/finish
docker/root/etc/s6.d/go-neb/run
@ -0,0 +1,6 @@
vendor/pkg
vendor/src
pkg
hooks
bin
.git
@ -12,6 +12,9 @@ bin
pkg
pkg
_obj
_obj
_test
_test
.idea
vendor/pkg
vendor/src
# Architecture specific extensions/prefixes
# Architecture specific extensions/prefixes
*.[568vq]
*.[568vq]
@ -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
VOLUME /data
EXPOSE 4050
EXPOSE 4050
ENTRYPOINT [ "/go-neb" ]
COPY docker/root /
ENTRYPOINT [ "/bin/s6-svscan" , "/etc/s6.d/" ]
@ -225,7 +225,12 @@ sensible-browser http://localhost:6060/pkg/github.com/matrix-org/go-neb
## Docker image
## 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:
The image sets the following environment variables:
```
```
@ -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 .
@ -0,0 +1,2 @@
#!/bin/sh
s6-svscanctl -t /etc/s6.d
@ -0,0 +1,3 @@
#!/bin/sh
chown -R ${UID}:${GID} /data
exec su-exec ${UID}:${GID} /usr/local/bin/go-neb