From 45080ccd9675fe7e8e957a14469383a786392643 Mon Sep 17 00:00:00 2001 From: MauroDruwel Date: Sat, 23 May 2026 11:15:49 +0200 Subject: [PATCH] chore: update Docker setup - Replace lowercase dockerfile with proper Dockerfile - Add .dockerignore for cleaner builds - Add build.sh script - Update docker-compose.yml: separate volumes for config, database, plugins; set restart policy to unless-stopped; remove deprecated version field --- .dockerignore | 4 ++++ Dockerfile | 19 +++++++++++++++++++ build.sh | 32 ++++++++++++++++++++++++++++++++ docker-compose.yml | 12 ++++++++---- dockerfile | 18 ------------------ 5 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 build.sh delete mode 100644 dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..108c1db --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +# Exclude local build artifacts — these are regenerated inside the container +node_modules/ +dist/ +.git/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3ca3de2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Docker File for Open Ticket v4 +FROM node:22-alpine + +# /home/container keeps Pterodactyl panel compatibility +WORKDIR /home/container + +# Install dependencies +COPY --chown=node:node package*.json ./ +RUN npm install + +# Copy app source +COPY --chown=node:node . . + +ENV NODE_ENV=production + +# Run as the built-in non-root node user +USER node + +CMD ["node", "index.js"] diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..b8fa916 --- /dev/null +++ b/build.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# build.sh — Build Open Ticket Docker images for all supported architectures. +# +# Usage: ./build.sh [--no-push] +# image Full image name, e.g. djj123dj/open-ticket +# +# Example: ./build.sh djj123dj/open-ticket --no-push + +set -euo pipefail + +IMAGE="${1:?Usage: ./build.sh [--no-push]}" +PLATFORMS="linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64" # linux/s390x is taking too long to build, so we'll skip it for now +VERSION=$(node -p "require('./package.json').version") + +# Create a multi-arch builder if it doesn't exist yet +docker buildx inspect ot-builder &>/dev/null \ + || docker buildx create --name ot-builder --driver docker-container --bootstrap --use +docker buildx use ot-builder + +PUSH_FLAG="--push" +[[ "${2:-}" == "--no-push" ]] && PUSH_FLAG="" + +docker buildx build \ + --platform "$PLATFORMS" \ + --tag "${IMAGE}:v${VERSION}" \ + --tag "${IMAGE}:latest" \ + $PUSH_FLAG \ + . + +[[ -n "$PUSH_FLAG" ]] \ + && echo "✓ Pushed ${IMAGE}:v${VERSION} and ${IMAGE}:latest" \ + || echo "✓ Built ${IMAGE}:v${VERSION} (not pushed)" diff --git a/docker-compose.yml b/docker-compose.yml index 8d6b02f..0651732 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,15 @@ # Docker Compose for Open Ticket v4 -version: '3' services: openticket: build: . volumes: - - openticket:/home/container - restart: no + - config:/home/container/config + - database:/home/container/database + - plugins:/home/container/plugins + restart: unless-stopped container_name: open-ticket + volumes: - openticket: \ No newline at end of file + config: + database: + plugins: \ No newline at end of file diff --git a/dockerfile b/dockerfile deleted file mode 100644 index 4a0acad..0000000 --- a/dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -# Docker File for Open Ticket v4 -# Use the official Node.js 20 image from Docker Hub -FROM node:20-alpine - -# Set pterodactyl working directory inside the container -WORKDIR /home/container - -# Copy package.json and package-lock.json into the container -COPY package*.json ./ - -# Install dependencies -RUN npm install - -# Copy the rest of your app's source code into the container -COPY . . - -# Run the bot from index.js -CMD ["node", "index.js"] \ No newline at end of file