Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1242 from ipfs/smaller-docker-image
Browse files Browse the repository at this point in the history
Various improvements to Docker Image
  • Loading branch information
victorb committed Mar 2, 2018
2 parents 4b1d471 + b744359 commit 420de91
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
24 changes: 14 additions & 10 deletions Dockerfile
@@ -1,25 +1,29 @@
FROM node:6

RUN apt-get update
RUN apt-get install --yes python2.7 git-all pkg-config libncurses5-dev libssl-dev libnss3-dev libexpat-dev libc6
FROM node:9.5.0

WORKDIR /usr/src/app

COPY package.json /usr/src/app/package.json

RUN npm install
RUN npm install wrtc

COPY . /usr/src/app

ENV IPFS_WRTC_LINUX_WINDOWS=1
ENV IPFS_BOOTSTRAP=1
ENV IPFS_MONITORING=1
ENV IPFS_PATH=/root/.jsipfs

ENV BUILD_DEPS='libnspr4 libnspr4-dev libnss3'

EXPOSE 4002
EXPOSE 4003
EXPOSE 5002
EXPOSE 9090

RUN apt-get update \
&& apt-get install --yes $BUILD_DEPS \
&& rm -rf /var/lib/apt/lists/* \
&& npm install --production \
&& npm install wrtc@0.0.67 --production \
&& npm cache clear --force \
&& apt-get purge --yes $BUILD_DEPS \
&& rm -rf /usr/share/doc /usr/share/locale \
&& rm -rf /usr/local/share/.cache \
&& rm -rf node_modules/go-ipfs-dep/go-ipfs/ipfs

CMD ./init-and-daemon.sh
16 changes: 14 additions & 2 deletions init-and-daemon.sh
@@ -1,6 +1,18 @@
#! /bin/sh -e
node src/cli/bin.js init
#! /usr/bin/env bash

set -e

if [ -n $IPFS_PATH ]; then
echo "Using $IPFS_PATH as IPFS repository"
else
echo "You need to set IPFS_PATH environment variable to use this script"
exit 1
fi

sed -i.bak 's/127.0.0.1/0.0.0.0/g' $IPFS_PATH/config

# Initialize the repo but ignore if error if it already exists
# This can be the case when we restart a container without stopping/removing it
node src/cli/bin.js init || true

node src/cli/bin.js daemon

0 comments on commit 420de91

Please sign in to comment.