@@ -13,10 +13,6 @@ EXPOSE 4002/udp
13
13
EXPOSE 5001
14
14
EXPOSE 8080
15
15
16
- # Volume for mounting an IPFS fs-repo
17
- # This is moved to the bottom for technical reasons.
18
- # VOLUME $IPFS_PATH
19
-
20
16
# IPFS API to use for fetching gx packages.
21
17
# This can be a gateway too, since its read-only API provides all gx needs.
22
18
# - e.g. /ip4/172.17.0.1/tcp/8080 if the Docker host
@@ -33,14 +29,17 @@ ENV GOPATH /go
33
29
ENV PATH /go/bin:$PATH
34
30
ENV SRC_PATH /go/src/github.com/ipfs/go-ipfs
35
31
32
+ # Expose the fs-repo as a volume.
33
+ # start_ipfs initializes an fs-repo if none is mounted
34
+ VOLUME $IPFS_PATH
35
+
36
36
# Get the go-ipfs sourcecode
37
37
COPY . $SRC_PATH
38
38
39
- RUN apk add --update musl-dev gcc go git bash wget ca-certificates \
40
- # Setup user and fs-repo directory
41
- && mkdir -p $IPFS_PATH \
39
+ RUN apk add --no-cache --virtual .build-deps-ipfs musl-dev gcc go git \
40
+ && apk add --no-cache tini su-exec bash wget ca-certificates \
41
+ # Setup user
42
42
&& adduser -D -h $IPFS_PATH -u 1000 ipfs \
43
- && chown ipfs:ipfs $IPFS_PATH && chmod 755 $IPFS_PATH \
44
43
# Install gx
45
44
&& go get -u github.com/whyrusleeping/gx \
46
45
&& go get -u github.com/whyrusleeping/gx-go \
@@ -58,22 +57,12 @@ RUN apk add --update musl-dev gcc go git bash wget ca-certificates \
58
57
&& cp $SRC_PATH/bin/container_daemon /usr/local/bin/start_ipfs \
59
58
&& chmod 755 /usr/local/bin/start_ipfs \
60
59
# Remove all build-time dependencies
61
- && apk del --purge musl-dev gcc go git && rm -rf $GOPATH && rm -vf $IPFS_PATH/api
62
-
63
- # Call uid 1000 "ipfs"
64
- USER ipfs
65
-
66
- # Expose the fs-repo as a volume.
67
- # We're doing this down here (and not at the top),
68
- # so that the overlay directory is owned by the ipfs user.
69
- # start_ipfs initializes an ephemeral fs-repo if none is mounted,
70
- # which is why uid=1000 needs write permissions there.
71
- VOLUME $IPFS_PATH
60
+ && apk del --purge .build-deps-ipfs && rm -rf $GOPATH && rm -vf $IPFS_PATH/api
72
61
73
62
# This just makes sure that:
74
63
# 1. There's an fs-repo, and initializes one if there isn't.
75
64
# 2. The API and Gateway are accessible from outside the container.
76
- ENTRYPOINT ["/usr/local/bin/start_ipfs" ]
65
+ ENTRYPOINT ["/sbin/tini" , "--" , "/ usr/local/bin/start_ipfs" ]
77
66
78
67
# Execute the daemon subcommand by default
79
68
CMD ["daemon" , "--migrate=true" ]
0 commit comments