Skip to content

Commit

Permalink
Running SnapHub with Docker Compose (snapshot-labs#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
fforbeck authored Sep 22, 2020
1 parent 3953dbf commit f42e7a6
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
.github
.gitignore
node_modules
npm-debug.log
.dockerignore
Dockerfile
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PORT=8080
VUE_APP_IPFS_NODE=ipfs.fleek.co
VUE_APP_ALCHEMY_KEY=rXKbp7PTFm6hcrxU8NL-JGp5RMfRHDwg
FLEEK_API_KEY=123...
Expand Down
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Node version matching the version declared in the package.json
FROM node:14.0-slim

# Update O.S.
RUN apt-get update && apt-get upgrade -y

# Install required O.S. packages
RUN apt-get install -y git python make g++

# Create the application workdir
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app

# Set current user
USER node

# Copy app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./

# Install app dependencies
RUN npm install

# Bundle app source
COPY --chown=node:node . .

# Set the container port
EXPOSE 8080

# Start the aplication
CMD ["npm", "run", "start" ]
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "3.7"
services:

# Snapshot Hub
snap-hub:
build: .
container_name: snap-hub
env_file:
- .env.local
depends_on:
- snap-redis
ports:
- "8080:8080"

# Snapshot Redis Instance
snap-redis:
image: redis:6.0
container_name: snap-redis

# Snapshot MySQL Instance
snap-mysql:
image: mysql:8.0.21
container_name: snap-mysql
environment:
MYSQL_USER: "admin"
MYSQL_PASSWORD: "admin"
MYSQL_DATABASE: "testdb"

networks:
default:
name: snap-network

0 comments on commit f42e7a6

Please sign in to comment.