mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-17 17:23:08 +02:00
feat(docker): add new Dockerfile
Co-authored-by: Uzurka <101745008+Uzurka@users.noreply.github.com>
This commit is contained in:
parent
6f97e4adc8
commit
e6bce8b331
@ -1 +1,19 @@
|
|||||||
|
# only db, scripts, src, and user directories are needed
|
||||||
|
.github
|
||||||
|
.husky
|
||||||
|
.vscode
|
||||||
|
logs
|
||||||
node_modules
|
node_modules
|
||||||
|
# prisma will generated by postinstall script
|
||||||
|
prisma
|
||||||
|
.all-contributorsrc
|
||||||
|
.commitlintrc.js
|
||||||
|
.dockerignore
|
||||||
|
.env
|
||||||
|
.eslintrc.json
|
||||||
|
.gitattributes
|
||||||
|
.gitignore
|
||||||
|
CONTRIBUTORS.md
|
||||||
|
Dockerfile
|
||||||
|
jsconfig.json
|
||||||
|
README.md
|
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
FROM node:18-alpine
|
||||||
|
|
||||||
|
ENV NODE_ENV=production \
|
||||||
|
HTTP_HOST=0.0.0.0 \
|
||||||
|
HTTP_PORT=80 \
|
||||||
|
SETTINGS_HOST=127.0.0.1 \
|
||||||
|
SETTINGS_PORT=8169
|
||||||
|
|
||||||
|
WORKDIR /usr/bot
|
||||||
|
|
||||||
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
|
||||||
|
COPY --link scripts scripts
|
||||||
|
|
||||||
|
# install python etc so node-gyp works for the optional dependencies
|
||||||
|
RUN apk add --no-cache --virtual .build-deps make gcc g++ python3 \
|
||||||
|
# install pnpm to make dependency installation faster (because it has a lockfile)
|
||||||
|
&& npm install -g pnpm \
|
||||||
|
# install dependencies, CI=true to skip pre/postinstall scripts
|
||||||
|
&& CI=true pnpm install --prod --frozen-lockfile \
|
||||||
|
# pnpm isn't needed now
|
||||||
|
&& npm uninstall pnpm --global \
|
||||||
|
# remove node-gyp stuff
|
||||||
|
&& apk del .build-deps
|
||||||
|
|
||||||
|
COPY --link . .
|
||||||
|
|
||||||
|
EXPOSE ${HTTP_PORT}
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/bin/sh", "/usr/bot/scripts/start.sh" ]
|
@ -7,6 +7,11 @@ function log (...strings) {
|
|||||||
console.log(short('&9[preinstall]&r'), ...strings);
|
console.log(short('&9[preinstall]&r'), ...strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.env.CI) {
|
||||||
|
log('CI detected, skipping');
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
const env = {
|
const env = {
|
||||||
DB_CONNECTION_URL: '',
|
DB_CONNECTION_URL: '',
|
||||||
DB_PROVIDER: '', // don't default to sqlite, postinstall checks if empty
|
DB_PROVIDER: '', // don't default to sqlite, postinstall checks if empty
|
||||||
|
10
scripts/start.sh
Normal file
10
scripts/start.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Checking environment..."
|
||||||
|
node scripts/preinstall
|
||||||
|
|
||||||
|
echo "Preparing the database..."
|
||||||
|
node scripts/postinstall
|
||||||
|
|
||||||
|
echo "Starting..."
|
||||||
|
node src/
|
Loading…
Reference in New Issue
Block a user