@cryptotaxi247 / kubo / commits / 60a43f89d

gomod: Update Dockerfile, remove Dockerfile.fast

The main Dockerfile supports dependencies caching now, rendering Dockerfile.fast useless. License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Mar 19, 2019 at 16:46 UTC 60a43f89da833c6e0bd989f166c6f4fb2ffb3b7d
5 files changed +10 -88
Dockerfile
+7 -10
@@ -1,22 +1,19 @@
1 -FROM golang:1.11-stretch
1 +FROM golang:1.12-stretch
2 MAINTAINER Lars Gierth <lgierth@ipfs.io>
3
4 -# There is a copy of this Dockerfile called Dockerfile.fast,
5 -# which is optimized for build time, instead of image size.
6 -#
7 -# Please keep these two Dockerfiles in sync.
4 +ENV SRC_DIR /go-ipfs
5
9 -ENV GX_IPFS ""
10 -ENV SRC_DIR /go/src/github.com/ipfs/go-ipfs
6 +# Download packages first so they can be cached.
7 +COPY go.mod go.sum $SRC_DIR/
8 +RUN cd $SRC_DIR \
9 + && go mod download
10
11 COPY . $SRC_DIR
12
13 # Build the thing.
14 # Also: fix getting HEAD commit hash via git rev-parse.
16 -# Also: allow using a custom IPFS API endpoint.
15 RUN cd $SRC_DIR \
16 && mkdir .git/objects \
19 - && ([ -z "$GX_IPFS" ] || echo $GX_IPFS > /root/.ipfs/api) \
17 && make build
18
19 # Get su-exec, a very minimal tool for dropping privileges,
@@ -41,7 +38,7 @@ FROM busybox:1-glibc
38 MAINTAINER Lars Gierth <lgierth@ipfs.io>
39
40 # Get the ipfs binary, entrypoint script, and TLS CAs from the build container.
44 -ENV SRC_DIR /go/src/github.com/ipfs/go-ipfs
41 +ENV SRC_DIR /go-ipfs
42 COPY --from=0 $SRC_DIR/cmd/ipfs/ipfs /usr/local/bin/ipfs
43 COPY --from=0 $SRC_DIR/bin/container_daemon /usr/local/bin/start_ipfs
44 COPY --from=0 /tmp/su-exec/su-exec /sbin/su-exec
Dockerfile.fast deleted
-75
@@ -1,75 +0,0 @@
1 -FROM golang:1.11-stretch
2 -MAINTAINER Lars Gierth <lgierth@ipfs.io>
3 -
4 -# This is a copy of /Dockerfile,
5 -# except that we optimize for build time, instead of image size.
6 -#
7 -# Please keep these two Dockerfiles in sync.
8 -
9 -ENV GX_IPFS ""
10 -ENV SRC_DIR /go/src/github.com/ipfs/go-ipfs
11 -
12 -COPY ./package.json $SRC_DIR/package.json
13 -
14 -# Fetch dependencies.
15 -# Also: allow using a custom IPFS API endpoint.
16 -RUN set -x \
17 - && go get github.com/whyrusleeping/gx \
18 - && go get github.com/whyrusleeping/gx-go \
19 - && ([ -z "$GX_IPFS" ] || echo $GX_IPFS > /root/.ipfs/api) \
20 - && cd $SRC_DIR \
21 - && gx install
22 -
23 -COPY . $SRC_DIR
24 -
25 -# Build the thing.
26 -# Also: fix getting HEAD commit hash via git rev-parse.
27 -RUN set -x \
28 - && cd $SRC_DIR \
29 - && mkdir .git/objects \
30 - && make build \
31 - && mv cmd/ipfs/ipfs /usr/local/bin/ipfs \
32 - && mv bin/container_daemon /usr/local/bin/start_ipfs
33 -
34 -# Get su-exec, a very minimal tool for dropping privileges,
35 -# and tini, a very minimal init daemon for containers
36 -ENV SUEXEC_VERSION v0.2
37 -ENV TINI_VERSION v0.16.1
38 -RUN set -x \
39 - && cd /tmp \
40 - && git clone https://github.com/ncopa/su-exec.git \
41 - && cd su-exec \
42 - && git checkout -q $SUEXEC_VERSION \
43 - && make \
44 - && cd /tmp \
45 - && wget -q -O tini https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini \
46 - && chmod +x tini \
47 - && mv su-exec/su-exec tini /sbin/ # Install them
48 -
49 -# Ports for Swarm TCP, Swarm uTP, API, Gateway, Swarm Websockets
50 -EXPOSE 4001
51 -EXPOSE 4002/udp
52 -EXPOSE 5001
53 -EXPOSE 8080
54 -EXPOSE 8081
55 -
56 -# Create the fs-repo directory and switch to a non-privileged user.
57 -ENV IPFS_PATH /data/ipfs
58 -RUN mkdir -p $IPFS_PATH \
59 - && useradd -s /usr/sbin/nologin -d $IPFS_PATH -u 1000 -G users ipfs \
60 - && chown ipfs:users $IPFS_PATH
61 -
62 -# Expose the fs-repo as a volume.
63 -# start_ipfs initializes an fs-repo if none is mounted.
64 -VOLUME $IPFS_PATH
65 -
66 -# The default logging level
67 -ENV IPFS_LOGGING ""
68 -
69 -# This just makes sure that:
70 -# 1. There's an fs-repo, and initializes one if there isn't.
71 -# 2. The API and Gateway are accessible from outside the container.
72 -ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/start_ipfs"]
73 -
74 -# Execute the daemon subcommand by default
75 -CMD ["daemon", "--migrate=true"]
test/3nodetest/Makefile
+1 -1
@@ -24,7 +24,7 @@ data/filerand: ../bin/random
24 # just build it every time... this part isn't
25 # even the lengthy part, and it decreases pain.
26 docker_ipfs_image:
27 - docker build -t $(IMAGE_NAME) -f Dockerfile.fast .
27 + docker build -t $(IMAGE_NAME) -f Dockerfile .
28 docker images | grep $(IMAGE_NAME)
29
30 clean:
test/sharness/t0300-docker-image.sh
+1 -1
@@ -33,7 +33,7 @@ TEST_TESTS_DIR=$(dirname "$TEST_SCRIPTS_DIR")
33 APP_ROOT_DIR=$(dirname "$TEST_TESTS_DIR")
34
35 test_expect_success "docker image build succeeds" '
36 - docker_build "$TEST_TESTS_DIR/../Dockerfile.fast" "$APP_ROOT_DIR" >actual ||
36 + docker_build "$TEST_TESTS_DIR/../Dockerfile" "$APP_ROOT_DIR" >actual ||
37 test_fsh echo "TEST_TESTS_DIR: $TEST_TESTS_DIR" ||
38 test_fsh echo "APP_ROOT_DIR : $APP_ROOT_DIR" ||
39 test_fsh cat actual
test/sharness/t0301-docker-migrate.sh
+1 -1
@@ -21,7 +21,7 @@ TEST_TESTS_DIR=$(dirname "$TEST_SCRIPTS_DIR")
21 APP_ROOT_DIR=$(dirname "$TEST_TESTS_DIR")
22
23 test_expect_success "docker image build succeeds" '
24 - docker_build "$TEST_TESTS_DIR/../Dockerfile.fast" "$APP_ROOT_DIR" >actual &&
24 + docker_build "$TEST_TESTS_DIR/../Dockerfile" "$APP_ROOT_DIR" >actual &&
25 IMAGE_ID=$(tail -n1 actual | cut -d " " -f 3)
26 '
27