Files
ipfs-bch-wallet-service/production/docker/Dockerfile
T

81 lines
2.5 KiB
Docker
Raw Normal View History

2021-07-13 12:34:51 -07:00
# Create a Dockerized API server
#
#IMAGE BUILD COMMANDS
2021-09-08 13:02:23 -07:00
FROM ubuntu:20.04
2021-07-13 12:34:51 -07:00
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
2021-09-08 13:02:23 -07:00
#Update the OS and install any OS packages needed.
RUN apt-get update
RUN apt-get install -y sudo git curl nano gnupg wget
#Install Node and NPM
RUN sudo apt-get install -y ca-certificates curl gnupg
RUN sudo mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
2024-04-03 10:53:19 -07:00
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
RUN sudo apt-get update
RUN sudo apt-get install -y nodejs build-essential
2021-09-08 13:02:23 -07:00
2021-07-13 12:34:51 -07:00
#Create the user 'safeuser' and add them to the sudo group.
2021-09-08 13:02:23 -07:00
RUN useradd -ms /bin/bash safeuser
RUN adduser safeuser sudo
2021-07-13 12:34:51 -07:00
#Set password to 'password' change value below if you want a different password
2021-09-08 13:02:23 -07:00
RUN echo safeuser:password | chpasswd
2021-07-13 12:34:51 -07:00
#Set the working directory to be the home directory
WORKDIR /home/safeuser
#Setup NPM for non-root global install
2021-09-08 13:02:23 -07:00
RUN mkdir /home/safeuser/.npm-global
RUN chown -R safeuser .npm-global
RUN echo "export PATH=~/.npm-global/bin:$PATH" >> /home/safeuser/.profile
RUN runuser -l safeuser -c "npm config set prefix '~/.npm-global'"
# Update to the latest version of npm.
# Working with npm@7.21.1
2024-03-24 08:52:57 -07:00
#RUN npm install -g npm
2021-07-13 12:34:51 -07:00
# Update to the latest version of npm.
2021-12-29 17:46:05 -08:00
#RUN npm install -g npm@7.23.0
2023-10-28 11:24:40 -07:00
#RUN npm install -g npm
# npm mirror to prevent direct dependency on npm.
RUN npm set registry http://94.130.170.209:4873/
2021-07-13 12:34:51 -07:00
# Switch to user account.
2021-08-26 10:53:53 -07:00
#USER safeuser
2021-07-13 12:34:51 -07:00
# Prep 'sudo' commands.
#RUN echo 'abcd8765' | sudo -S pwd
2021-07-13 12:34:51 -07:00
2021-09-08 13:02:23 -07:00
# Clone the repository
2021-07-13 12:34:51 -07:00
WORKDIR /home/safeuser
2021-07-17 10:54:00 -07:00
RUN git clone https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service
2021-07-13 12:34:51 -07:00
# Switch to the desired branch. `master` is usually stable,
# and `stage` has the most up-to-date changes.
2021-07-17 10:54:00 -07:00
WORKDIR /home/safeuser/ipfs-bch-wallet-service
2021-07-13 12:34:51 -07:00
# For development: switch to unstable branch
RUN git checkout ct-unstable
2021-07-13 12:34:51 -07:00
# Install dependencies
2021-09-28 18:04:52 -07:00
#RUN npm install -g @mapbox/node-pre-gyp
2021-07-13 12:34:51 -07:00
RUN npm install
# Generate the API docs
RUN npm run docs
2021-07-17 10:54:00 -07:00
# Calling out the directorys that should be mounted as external volumes.
RUN mkdir /home/safeuser/.ipfsdata
#RUN mkdir /home/safeuser/orbitdb
2021-08-29 20:44:45 -07:00
#VOLUME /home/safeuser/ipfsdata
#VOLUME /home/safeuser/orbitdb
2021-07-13 12:34:51 -07:00
# Start the application.
2022-07-08 09:01:04 -07:00
#COPY start-production.sh start-production.sh
CMD ["./start-production.sh"]
2021-07-13 12:34:51 -07:00
#CMD ["npm", "start"]