diff --git a/Dockerfile b/Dockerfile index 6a00335..f9a9c58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,15 @@ -# Would use bun, but because better-sqlite3 hates it haha -FROM node:22 +# If the bot runs poorly or errors, +# remove -slim from the image name +FROM node:22-slim WORKDIR /app -COPY . . -RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/* -RUN ln -s /usr/bin/python3 /usr/bin/python +COPY package.json package-lock.json ./ +RUN apt-get update && apt-get install -y python3 make g++ \ + && rm -rf /var/lib/apt/lists/* \ + && ln -s /usr/bin/python3 /usr/bin/python \ + && npm ci --omit=dev -RUN npm install --omit=dev +COPY . . -CMD ["npm", "run", "start"] \ No newline at end of file +CMD ["npm", "start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..23b281e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +services: + bot: + build: + context: . + dockerfile: Dockerfile + container_name: ticket-bot + restart: unless-stopped + environment: + NODE_ENV: production + volumes: + - ticketbotdata:./data # must match the dbpath value in config.yml + +volumes: + ticketbotdata: