Commit ff1e58a4 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

Merge pull request #1128 from Luzifer/dockerfile_expose

Improve Dockerfile
parents 196c6aa4 3534b039
FROM golang:1.4
MAINTAINER Brian Tiger Chow <btc@perfmode.com>
ENV IPFS_PATH /data/ipfs
RUN useradd -m -d /data -u 1000 ipfs && \
mkdir -p /data/ipfs && chown ipfs:ipfs /data/ipfs
EXPOSE 4001 5001 8080
# 4001 = Swarm, 5001 = API, 8080 = HTTP transport
VOLUME /data/ipfs
ADD . /go/src/github.com/ipfs/go-ipfs
RUN cd /go/src/github.com/ipfs/go-ipfs/cmd/ipfs && go install
RUN cp /go/src/github.com/ipfs/go-ipfs/bin/container_daemon /usr/local/bin/start_ipfs && \
chmod 755 /usr/local/bin/start_ipfs
EXPOSE 4001 5001 8080
# 4001 = Swarm, 5001 = API, 8080 = HTTP transport
USER ipfs
ENTRYPOINT ["/usr/local/bin/start_ipfs"]
......
#!/bin/bash
ipfs init
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
# Test whether the mounted directory is writable for us
if ( touch /data/ipfs/write_test 2>/dev/null ); then
rm /data/ipfs/write_test
else
echo "ERR: /data/ipfs is not writable for user 'ipfs' (UID 1000)"
exit 1
fi
echo "Running $(ipfs version)..."
if [ -e /data/ipfs/config ]; then
echo "Found ipfs repository. Not initializing."
else
ipfs init
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
fi
ipfs daemon
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment