This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various improvements to Docker Image
- Smaller size (from 1.52GB to 875MB) - Ignore errors with init as repository could already be initialized if we restart a running container for example - Locks down version of wrtc - Upgrade from node@6 to node@9.5 Docker
- Loading branch information
Showing
2 changed files
with
28 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |