1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-22 12:51:19 +08:00

Migrated Dockerfile to use alpine linux

License: MIT Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers
2015-07-15 09:49:16 +02:00
parent 7077d71740
commit a245a27c17
2 changed files with 24 additions and 8 deletions

View File

@ -1,21 +1,27 @@
FROM golang:1.4 FROM alpine:3.2
MAINTAINER Brian Tiger Chow <btc@perfmode.com> MAINTAINER Brian Tiger Chow <btc@perfmode.com>
ENV IPFS_PATH /data/ipfs ENV IPFS_PATH /data/ipfs
ENV VERSION master
RUN useradd -m -d /data -u 1000 ipfs && \
mkdir -p /data/ipfs && chown ipfs:ipfs /data/ipfs
EXPOSE 4001 5001 8080 EXPOSE 4001 5001 8080
# 4001 = Swarm, 5001 = API, 8080 = HTTP transport # 4001 = Swarm, 5001 = API, 8080 = HTTP transport
VOLUME /data/ipfs VOLUME /data/ipfs
ADD . /go/src/github.com/ipfs/go-ipfs ADD bin/container_daemon /usr/local/bin/start_ipfs
RUN cd /go/src/github.com/ipfs/go-ipfs/cmd/ipfs && go install ADD bin/container_shacheck /usr/local/bin/shacheck
RUN cp /go/src/github.com/ipfs/go-ipfs/bin/container_daemon /usr/local/bin/start_ipfs && \ RUN adduser -D -h /data -u 1000 ipfs \
chmod 755 /usr/local/bin/start_ipfs && mkdir -p /data/ipfs && chown ipfs:ipfs /data/ipfs \
&& apk add --update bash curl wget ca-certificates zip \
&& wget https://gobuilder.me/get/github.com/ipfs/go-ipfs/cmd/ipfs/ipfs_${VERSION}_linux-386.zip \
&& /bin/bash /usr/local/bin/shacheck ${VERSION} ipfs_${VERSION}_linux-386.zip \
&& unzip ipfs_${VERSION}_linux-386.zip \
&& rm ipfs_${VERSION}_linux-386.zip \
&& mv ipfs/ipfs /usr/local/bin/ipfs \
&& chmod 755 /usr/local/bin/start_ipfs \
&& apk del wget zip curl
USER ipfs USER ipfs

10
bin/container_shacheck Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash -xe
VERSION=$1
FILENAME=$2
ONLINE_SHA=$( curl "https://gobuilder.me/api/v1/github.com/ipfs/go-ipfs/cmd/ipfs/signed-hashes/${VERSION}" 2>/dev/null | grep -A 4 ${FILENAME} | grep sha1 | awk '{ print $3 }' )
echo "Checking SHA1: ${ONLINE_SHA} == $(sha1sum ${FILENAME} | awk '{print $1}')"
echo "${ONLINE_SHA} ${FILENAME}" | sha1sum -cw