Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit bc0415e

Browse files
committed
feat(Dockerfile): add docker client
1 parent 3a99d26 commit bc0415e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
# Build the Nixster binary
44
# Note that the `nixster` binary produced will include native modules
5-
# e.g. better-sqlite3.node for the platform it is built on (so it needs
5+
# e.g. `better-sqlite3.node` for the platform it is built on (so it needs
66
# to be a Linux builder to run on Linux-based Docker image)
7+
# You can test this stage alone by building and running like this:
8+
# docker build . --target builder --tag stencila/nixster:builder
9+
# docker run --rm -it -p 3000:3000 stencila/nixster:builder ./build/nixster serve
710

811
FROM node:10 AS builder
912
WORKDIR /nixster
@@ -73,4 +76,11 @@ RUN nix-channel --add https://nixos.org/channels/nixos-18.09 \
7376
&& nix-channel --update \
7477
&& nixster update nixos-18.09
7578

79+
# Install Docker (only the client is used in this image, the daemon runs elsewhere)
80+
# HT to https://stackoverflow.com/a/43594065
81+
ENV DOCKERVERSION=18.09.1
82+
RUN wget https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
83+
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 -C /usr/local/bin docker/docker \
84+
&& rm docker-${DOCKERVERSION}.tgz
85+
7686
CMD nixster serve

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ docker-build:
3737

3838
# Run the Nixster server
3939
docker-serve:
40-
docker run --rm --interactive --tty --volume $$PWD/nixstore:/nixstore --publish 3000:3000 stencila/nixster nixster serve
40+
docker run --rm --interactive --tty \
41+
--volume $$PWD/nixstore:/nixstore \
42+
--volume /var/run/docker.sock:/var/run/docker.sock \
43+
--publish 3000:3000 \
44+
stencila/nixster nixster serve
4145

4246
# Interact with the container in a Bash shell. Useful for debugging build errors
4347
docker-interact:

0 commit comments

Comments
 (0)