Skip to content

Commit 7e02cbe

Browse files
feature: docker
1 parent 596a515 commit 7e02cbe

File tree

6 files changed

+162
-6403
lines changed

6 files changed

+162
-6403
lines changed

.dockerignore

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Copy from https://github.com/github/gitignore/blob/master/Node.gitignore
2+
3+
lib
4+
data/*
5+
6+
# Logs
7+
logs
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
lerna-debug.log*
13+
14+
# Diagnostic reports (https://nodejs.org/api/report.html)
15+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
*.lcov
29+
30+
# nyc test coverage
31+
.nyc_output
32+
33+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
34+
.grunt
35+
36+
# Bower dependency directory (https://bower.io/)
37+
bower_components
38+
39+
# node-waf configuration
40+
.lock-wscript
41+
42+
# Compiled binary addons (https://nodejs.org/api/addons.html)
43+
build/Release
44+
45+
# Dependency directories
46+
node_modules/
47+
jspm_packages/
48+
49+
# Snowpack dependency directory (https://snowpack.dev/)
50+
web_modules/
51+
52+
# TypeScript cache
53+
*.tsbuildinfo
54+
55+
# Optional npm cache directory
56+
.npm
57+
58+
# Optional eslint cache
59+
.eslintcache
60+
61+
# Microbundle cache
62+
.rpt2_cache/
63+
.rts2_cache_cjs/
64+
.rts2_cache_es/
65+
.rts2_cache_umd/
66+
67+
# Optional REPL history
68+
.node_repl_history
69+
70+
# Output of 'npm pack'
71+
*.tgz
72+
73+
# Yarn Integrity file
74+
.yarn-integrity
75+
76+
# dotenv environment variables file
77+
.env
78+
.env.test
79+
80+
# parcel-bundler cache (https://parceljs.org/)
81+
.cache
82+
.parcel-cache
83+
84+
# Next.js build output
85+
.next
86+
out
87+
88+
# Nuxt.js build / generate output
89+
.nuxt
90+
dist
91+
92+
# Gatsby files
93+
.cache/
94+
# Comment in the public line in if your project uses Gatsby and not Next.js
95+
# https://nextjs.org/blog/next-9-1#public-directory-support
96+
# public
97+
98+
# vuepress build output
99+
.vuepress/dist
100+
101+
# Serverless directories
102+
.serverless/
103+
104+
# FuseBox cache
105+
.fusebox/
106+
107+
# DynamoDB Local files
108+
.dynamodb/
109+
110+
# TernJS port file
111+
.tern-port
112+
113+
# Stores VSCode versions used for testing VSCode extensions
114+
.vscode-test
115+
116+
# yarn v2
117+
.yarn/cache
118+
.yarn/unplugged
119+
.yarn/build-state.yml
120+
.yarn/install-state.gz
121+
.pnp.*

DockerFile

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
1-
FROM keymetrics/pm2:latest-alpine
1+
# syntax=docker/dockerfile:1
22

3-
# Not tested nor used -- copy paste from https://pm2.io/docs/runtime/integration/docker/#set-a-dockerfile essentially
3+
FROM node:21-alpine
44

5-
# Bundle APP files
6-
COPY src src/
7-
COPY package.json .
8-
COPY ecosystem.config.js .
5+
WORKDIR /app
6+
COPY . .
97

10-
# Install app dependencies
11-
ENV NPM_CONFIG_LOGLEVEL warn
12-
RUN npm install --production
8+
RUN apk add --no-cache bash
9+
RUN apk add --no-cache git
1310

14-
# Expose the listening port of your app
15-
# EXPOSE 8000
11+
RUN corepack enable
12+
RUN npm install --global pm2
13+
RUN pm2 install pm2-logrotate
14+
RUN yarn install
1615

17-
# Show current folder structure in logs
18-
RUN ls -al -R
19-
20-
CMD [ "pm2-runtime", "start", "pm2.config.js" ]
16+
CMD ["pm2-runtime", "start", "pm2.config.cjs"]

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3'
2+
3+
volumes:
4+
data:
5+
6+
services:
7+
discord-bot:
8+
build:
9+
context: ./
10+
dockerfile: dockerfile
11+
env_file: '.env'
12+
volumes:
13+
- data:/app/data
14+
- data:/app/logs

0 commit comments

Comments
 (0)