Skip to content

Commit

Permalink
Merge pull request #21 from globalfund/feat/docker
Browse files Browse the repository at this point in the history
feat: docker setup
  • Loading branch information
stephanoshadjipetrou authored Feb 16, 2024
2 parents f78188e + e1cc87f commit 0a46c06
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:16.19.1-alpine3.17

# For development add /bin/bash
RUN apk update && apk add --no-cache bash

# Set up the server directory
WORKDIR /app
COPY . /app

# Install yarn dependencies
RUN yarn install --network-timeout 100000
RUN yarn build

# Install yarn dependencies
RUN yarn global add pm2
RUN yarn install
RUN yarn build

# APP LOG DIRECTORY FROM pm2.config.js
RUN mkdir -p /home/zim/app-logs/the-data-explorer-api

# Run `yarn docker` to build, migrate and run the server with pm2.
CMD ["yarn", "docker"]
15 changes: 15 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:16.19.1-alpine3.17

# For development add /bin/bash
RUN apk update && apk add --no-cache bash

# Set up the server directory
WORKDIR /app
COPY . /app

# Install yarn dependencies
RUN yarn install --network-timeout 100000
RUN yarn build

# Run `yarn docker` to build, migrate and run the server with pm2.
CMD ["yarn", "dev"]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"clean": "lb-clean dist *.tsbuildinfo .eslintcache",
"rebuild": "yarn run clean && yarn run build",
"dev": "nodemon server.js",
"deploy": "yarn prestart && pm2 start pm2.config.js --env production"
"deploy": "yarn prestart && pm2 start pm2.config.js --env production",
"docker": "yarn prestart && pm2-runtime start pm2.config.js --env production"
},
"nodemonConfig": {
"verbose": true,
Expand Down

0 comments on commit 0a46c06

Please sign in to comment.