From 3d476ec64e7461cb15178b1384d2ac1924e81c9f Mon Sep 17 00:00:00 2001 From: rob-deutsch Date: Mon, 8 Oct 2018 12:58:52 +1100 Subject: [PATCH 1/2] Dockerfile caches gx dependancies License: MIT Signed-off-by: Rob Deutsch --- Dockerfile | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3246f2c0bf8..898b4b9a8f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,14 +9,24 @@ MAINTAINER Lars Gierth ENV GX_IPFS "" ENV SRC_DIR /go/src/github.com/ipfs/go-ipfs +COPY ./package.json $SRC_DIR/package.json + +# Fetch dependencies. +# Also: allow using a custom IPFS API endpoint. +RUN set -x \ + && go get github.com/whyrusleeping/gx \ + && go get github.com/whyrusleeping/gx-go \ + && ([ -z "$GX_IPFS" ] || echo $GX_IPFS > /root/.ipfs/api) \ + && cd $SRC_DIR \ + && gx install + COPY . $SRC_DIR # Build the thing. # Also: fix getting HEAD commit hash via git rev-parse. -# Also: allow using a custom IPFS API endpoint. -RUN cd $SRC_DIR \ +RUN set -x \ + && cd $SRC_DIR \ && mkdir .git/objects \ - && ([ -z "$GX_IPFS" ] || echo $GX_IPFS > /root/.ipfs/api) \ && make build # Get su-exec, a very minimal tool for dropping privileges, From 9cb4d02288a514b198c9714b18d5695a5145ede1 Mon Sep 17 00:00:00 2001 From: rob-deutsch Date: Mon, 8 Oct 2018 13:03:25 +1100 Subject: [PATCH 2/2] suexec & tini cached in Dockerfiles License: MIT Signed-off-by: Rob Deutsch --- Dockerfile | 18 +++++++++--------- Dockerfile.fast | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 898b4b9a8f8..518c4d8d0e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,15 +20,6 @@ RUN set -x \ && cd $SRC_DIR \ && gx install -COPY . $SRC_DIR - -# Build the thing. -# Also: fix getting HEAD commit hash via git rev-parse. -RUN set -x \ - && cd $SRC_DIR \ - && mkdir .git/objects \ - && make build - # Get su-exec, a very minimal tool for dropping privileges, # and tini, a very minimal init daemon for containers ENV SUEXEC_VERSION v0.2 @@ -43,6 +34,15 @@ RUN set -x \ && wget -q -O tini https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini \ && chmod +x tini +COPY . $SRC_DIR + +# Build the thing. +# Also: fix getting HEAD commit hash via git rev-parse. +RUN set -x \ + && cd $SRC_DIR \ + && mkdir .git/objects \ + && make build + # Get the TLS CA certificates, they're not provided by busybox. RUN apt-get update && apt-get install -y ca-certificates diff --git a/Dockerfile.fast b/Dockerfile.fast index e4266cb21b3..a3a85112c0a 100644 --- a/Dockerfile.fast +++ b/Dockerfile.fast @@ -20,17 +20,6 @@ RUN set -x \ && cd $SRC_DIR \ && gx install -COPY . $SRC_DIR - -# Build the thing. -# Also: fix getting HEAD commit hash via git rev-parse. -RUN set -x \ - && cd $SRC_DIR \ - && mkdir .git/objects \ - && make build \ - && mv cmd/ipfs/ipfs /usr/local/bin/ipfs \ - && mv bin/container_daemon /usr/local/bin/start_ipfs - # Get su-exec, a very minimal tool for dropping privileges, # and tini, a very minimal init daemon for containers ENV SUEXEC_VERSION v0.2 @@ -46,6 +35,17 @@ RUN set -x \ && chmod +x tini \ && mv su-exec/su-exec tini /sbin/ # Install them +COPY . $SRC_DIR + +# Build the thing. +# Also: fix getting HEAD commit hash via git rev-parse. +RUN set -x \ + && cd $SRC_DIR \ + && mkdir .git/objects \ + && make build \ + && mv cmd/ipfs/ipfs /usr/local/bin/ipfs \ + && mv bin/container_daemon /usr/local/bin/start_ipfs + # Ports for Swarm TCP, Swarm uTP, API, Gateway, Swarm Websockets EXPOSE 4001 EXPOSE 4002/udp