Skip to content

Commit

Permalink
Add a Dockerfile
Browse files Browse the repository at this point in the history
First, start a redis container:
$ docker run --name redis -d redis

Build the mirrorbits container:
$ docker build -t mirrorbits .

Start the mirrorbits container and mount the repository from the host:
$ docker run --name mirrorbits --link redis:redis -v /path/to/repo/on/host:/srv/repo -i -t mirrorbits

Finally, to access the cli:
$ docker exec -i -t mirrorbits /bin/bash

You can now issue 'mirrorbits' cli commands within the container.
  • Loading branch information
etix committed Jan 20, 2017
1 parent b4cc71f commit 59ba21b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
@@ -0,0 +1,17 @@
FROM golang:latest

MAINTAINER etix@l0cal.com

ADD . /go/src/github.com/etix/mirrorbits

RUN apt-get update -y && apt-get install -y apt-utils
RUN apt-get install -y pkg-config zlib1g-dev libgeoip-dev rsync
RUN mkdir /var/log/mirrorbits && mkdir /srv/repo && touch /srv/repo/hello
RUN /bin/bash /go/src/github.com/etix/mirrorbits/contrib/geoip/geoip-lite-update
RUN cd /go/src/github.com/etix/mirrorbits && go get -d ./...
RUN cd /go/src/github.com/etix/mirrorbits && make
RUN ln -s /go/src/github.com/etix/mirrorbits/bin/mirrorbits /usr/bin/mirrorbits && ln -s /go/src/github.com/etix/mirrorbits/contrib/docker/mirrorbits.conf /etc/mirrorbits.conf

ENTRYPOINT /bin/sh /go/src/github.com/etix/mirrorbits/contrib/docker/prepare.sh && /usr/bin/mirrorbits -config /etc/mirrorbits.conf -D

EXPOSE 8080
23 changes: 23 additions & 0 deletions contrib/docker/mirrorbits.conf
@@ -0,0 +1,23 @@
# vim: set ft=yaml:

Repository: /srv/repo
Templates: /go/src/github.com/etix/mirrorbits/templates/
GoogleMapsAPIKey:
OutputMode: auto
ListenAddress: :8080
Gzip: false
LogDir: /var/log/mirrorbits
TraceFileLocation:
GeoipDatabasePath: /usr/share/GeoIP/
ConcurrentSync: 5
ScanInterval: 30
CheckInterval: 1
RepositoryScanInterval: 5
Hashes:
SHA1: Off
SHA256: On
MD5: Off
DisallowRedirects: false
WeightDistributionRange: 1.5
DisableOnMissingFile: false
MaxLinkHeaders: 10
10 changes: 10 additions & 0 deletions contrib/docker/prepare.sh
@@ -0,0 +1,10 @@
#!/bin/sh

if [ -z "$REDIS_PORT_6379_TCP_ADDR" ] || [ -z "$REDIS_PORT_6379_TCP_PORT" ]
then
echo "Missing link to Redis: use --link redis:redis"
exit 1
fi

echo "RedisAddress: $REDIS_PORT_6379_TCP_ADDR:$REDIS_PORT_6379_TCP_PORT" >> /go/src/github.com/etix/mirrorbits/contrib/docker/mirrorbits.conf

0 comments on commit 59ba21b

Please sign in to comment.