Skip to content

Commit

Permalink
feat: docker setup
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvanr committed Dec 4, 2023
1 parent f78188e commit e1cc87f
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 e1cc87f

Please sign in to comment.