Skip to content

Commit

Permalink
Beaver based generation of dhtnode docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent 70972b3 commit 1bb9e2e
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 10 deletions.
26 changes: 17 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ env:
# Do a shallow submodule fetch
before_install: git submodule update --init

# Create docker images and setup environment to build
install: beaver dlang install

# (Ab)use Travis cache to pass artifacts between stages.
# As long as the environment variables of different stages match, travis will
# pull the same "cache", so we can use this to actually pass artifacts between
Expand All @@ -41,15 +38,19 @@ jobs:
stage: Test
after_success: beaver dlang codecov
script:
# can't set it in env section or it will be overwritten by actual
# test definition after anchor is injected - YAML doesn't support
# appending to anchored object keys and we need `env` section
# to be overriden in matrix for compiler versions
- export BEAVER_DOCKER_IMG=builder BEAVER_DOCKER_CONTEXT=docker/builder
- beaver dlang install
- beaver dlang make
# Build packages too, this should be done by beaver:
# https://github.com/sociomantic-tsunami/beaver/issues/34
- beaver dlang make pkg
# If this is a tag, save the packages in the cache directory so
# it's accessible in the Upload Package stage
- if test -n "$TRAVIS_TAG"; then
cp -v build/last/pkg/*.deb "$ARTIFACTS_DIR/";
fi
# Save the packages in the cache directory so
# it's accessible in next stages
- cp -v build/last/pkg/*.deb "$ARTIFACTS_DIR/";
include:
# Test matrix
- <<: *test-matrix
Expand All @@ -60,7 +61,14 @@ jobs:
env: DMD=2.070.2.s* F=production
- <<: *test-matrix
env: DMD=2.070.2.s* F=devel

- stage: Generate deployment image
env: DMD=2.070.2.s* F=production
script:
# and here env section can't be used because that will confuse
# travis cache logic
- export BEAVER_DOCKER_IMG=sociomantictsunami/dhtnode BEAVER_DOCKER_CONTEXT=docker/runner
- cp "$ARTIFACTS_DIR"/*.deb $BEAVER_DOCKER_CONTEXT/
- beaver install
- stage: Upload Package
if: tag IS present
env: DMD=1.081.* F=production
Expand Down
12 changes: 12 additions & 0 deletions deploy/docker-compose-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# requires dhtnode docker image already present in the cache
# start with `docker-compose -f docker-compose-example.yml up
version: '2'
services:
dhtnode:
image: sociomantictsunami/dhtnode
ports:
- "10000:10000"
volumes:
- "dhtdata:/src/dhtnode/dhtnode-0/data"
volumes:
dhtdata:
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions docker/runner/Dockerfile.xenial
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM sociomantictsunami/dlang:xenial-v4
COPY docker/runner/dhtnode-d*.deb /packages/
RUN apt update && apt install libebtree6
RUN mkdir -p /srv/dhtnode/dhtnode-0 && apt install -y /packages/*.deb
COPY doc/etc/dht.config.ini /srv/dhtnode/dhtnode-0/etc/config.ini
WORKDIR /srv/dhtnode/dhtnode-0
CMD [ "/usr/sbin/dhtnode-d2", "-c", "/srv/dhtnode/dhtnode-0/etc/config.ini" ]
3 changes: 3 additions & 0 deletions docker/runner/dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!docker/runner
!doc

0 comments on commit 1bb9e2e

Please sign in to comment.