Adding docker files

This commit is contained in:
Chris Troutner
2019-02-07 17:25:46 -08:00
parent ff11452cf0
commit 3c631cbece
3 changed files with 92 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
# Start the testnet server with the command 'docker-compose up -d'
koa-mongodb:
image: mongo
ports:
- "27017:27017" # <host port>:<container port>
volumes:
- ./database:/data/db
command: mongod --smallfiles --logpath=/dev/null # -- quiet
restart: always
koa:
build: ./koa-boilerplate/
dockerfile: Dockerfile
links:
- koa-mongodb
ports:
- "3000:3000" # <host port>:<container port>
volumes:
# - ./logs:/home/coinjoin/consolidating-coinjoin/logs
- ./keys:/home/safeuser/keys
restart: always
tor:
image: goldy/tor-hidden-service
links:
- koa
environment:
PORT_MAP: 80 # Map port to detected service
volumes:
- ./keys:/var/lib/tor/hidden_service/
+57
View File
@@ -0,0 +1,57 @@
# Create a Dockerized API server
#
#IMAGE BUILD COMMANDS
# ct-base-ubuntu = ubuntu 18.04 + nodejs
FROM christroutner/ct-base-ubuntu
MAINTAINER Chris Troutner <chris.troutner@gmail.com>
#Create the user 'safeuser' and add them to the sudo group.
#RUN useradd -ms /bin/bash safeuser
#RUN adduser safeuser sudo
#Set password to 'password' change value below if you want a different password
#RUN echo safeuser:password | chpasswd
#Set the working directory to be the home directory
WORKDIR /home/safeuser
#Setup NPM for non-root global install
#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'"
# Expose the port the API will be served on.
EXPOSE 5000
# Switch to user account.
USER safeuser
# Prep 'sudo' commands.
RUN echo 'abcd8765' | sudo -S pwd
# Clone the rest.bitcoin.com repository
WORKDIR /home/safeuser
RUN git clone https://github.com/christroutner/babel-free-koa2-api-boilerplate
RUN mv babel-free-koa2-api-boilerplate koa
RUN mkdir keys
# Switch to the desired branch. `master` is usually stable,
# and `stage` has the most up-to-date changes.
WORKDIR /home/safeuser/koa
# For development: switch to unstable branch
RUN git checkout docker
# Install dependencies
RUN npm install
VOLUME /home/safeuser/keys
EXPOSE 3000
# Start the application.
COPY start-production start-production
CMD ["./start-production"]
#CMD ["npm", "start"]
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
export KOA_ENV=production
npm start