undockerize
This commit is contained in:
parent
5f1458e5a2
commit
5a27070437
8 changed files with 19 additions and 155 deletions
|
@ -1,36 +0,0 @@
|
||||||
# For more help, visit the .dockerignore file reference guide [here](https://docs.docker.com/go/build-context-dockerignore/)
|
|
||||||
|
|
||||||
**/.classpath
|
|
||||||
**/.dockerignore
|
|
||||||
**/.env
|
|
||||||
**/.git
|
|
||||||
**/.gitignore
|
|
||||||
**/.project
|
|
||||||
**/.settings
|
|
||||||
**/.toolstarget
|
|
||||||
**/.vs
|
|
||||||
**/.vscode
|
|
||||||
**/.next
|
|
||||||
**/.cache
|
|
||||||
**/*.*proj.user
|
|
||||||
**/*.dbmdl
|
|
||||||
**/*.jfm
|
|
||||||
**/charts
|
|
||||||
**/docker-compose*
|
|
||||||
**/compose.y*ml
|
|
||||||
**/Dockerfile*
|
|
||||||
**/node_modules
|
|
||||||
**/npm-debug.log
|
|
||||||
**/obj
|
|
||||||
**/secrets.dev.yaml
|
|
||||||
**/values.dev.yaml
|
|
||||||
**/build
|
|
||||||
**/dist
|
|
||||||
LICENSE
|
|
||||||
README.md
|
|
||||||
|
|
||||||
data/main_db.json
|
|
||||||
data/test_db.json
|
|
||||||
stack.env
|
|
||||||
public/css/*.css
|
|
||||||
public/courses/*.txt
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,9 +1,9 @@
|
||||||
# Custom
|
# Custom
|
||||||
stack.env
|
|
||||||
public/css/*
|
public/css/*
|
||||||
public/courses/*
|
public/courses/*
|
||||||
data/*
|
data/*
|
||||||
!data/main_db.example.json
|
!data/main_db.example.json
|
||||||
|
config.js
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
|
|
83
Dockerfile
83
Dockerfile
|
@ -1,83 +0,0 @@
|
||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
# Comments are provided throughout this file to help you get started.
|
|
||||||
# If you need more help, visit the Dockerfile reference guide at
|
|
||||||
# https://docs.docker.com/go/dockerfile-reference/
|
|
||||||
|
|
||||||
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7
|
|
||||||
|
|
||||||
ARG NODE_VERSION=18.17.1
|
|
||||||
ARG PNPM_VERSION=9.7.1
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Use node image for base image for all stages.
|
|
||||||
FROM node:${NODE_VERSION}-alpine as base
|
|
||||||
|
|
||||||
# Set working directory for all build stages.
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
|
|
||||||
# Install pnpm.
|
|
||||||
RUN --mount=type=cache,target=/root/.npm \
|
|
||||||
npm install -g pnpm@${PNPM_VERSION}
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Create a stage for installing production dependecies.
|
|
||||||
FROM base as deps
|
|
||||||
|
|
||||||
# Download dependencies as a separate step to take advantage of Docker's caching.
|
|
||||||
# Leverage a cache mount to /root/.local/share/pnpm/store to speed up subsequent builds.
|
|
||||||
# Leverage bind mounts to package.json and pnpm-lock.yaml to avoid having to copy them
|
|
||||||
# into this layer.
|
|
||||||
RUN --mount=type=bind,source=package.json,target=package.json \
|
|
||||||
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
|
|
||||||
--mount=type=cache,target=/root/.local/share/pnpm/store \
|
|
||||||
pnpm install --prod --frozen-lockfile
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Create a stage for building the application.
|
|
||||||
FROM deps as build
|
|
||||||
|
|
||||||
# Download additional development dependencies before building, as some projects require
|
|
||||||
# "devDependencies" to be installed to build. If you don't need this, remove this step.
|
|
||||||
RUN --mount=type=bind,source=package.json,target=package.json \
|
|
||||||
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
|
|
||||||
--mount=type=cache,target=/root/.local/share/pnpm/store \
|
|
||||||
pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
# Copy the rest of the source files into the image.
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Run the build script.
|
|
||||||
RUN pnpm run build
|
|
||||||
|
|
||||||
# This project specific
|
|
||||||
RUN mv stack.env.example stack.env
|
|
||||||
RUN mv data/main_db.example.json data/main_db.json
|
|
||||||
RUN chmod -R 777 data/
|
|
||||||
RUN chmod -R 777 public/
|
|
||||||
# End
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Create a new stage to run the application with minimal runtime dependencies
|
|
||||||
# where the necessary files are copied from the build stage.
|
|
||||||
FROM base as final
|
|
||||||
|
|
||||||
# Use production node environment by default.
|
|
||||||
ENV NODE_ENV production
|
|
||||||
|
|
||||||
# Run the application as a non-root user.
|
|
||||||
USER node
|
|
||||||
|
|
||||||
# Copy package.json so that package manager commands can be used.
|
|
||||||
COPY package.json .
|
|
||||||
|
|
||||||
# Copy the production dependencies from the deps stage and also
|
|
||||||
# the built application from the build stage into the image.
|
|
||||||
COPY --from=deps /usr/src/app/node_modules ./node_modules
|
|
||||||
COPY --from=build /usr/src/app/. ./.
|
|
||||||
|
|
||||||
# Expose the port that the application listens on.
|
|
||||||
EXPOSE 6547
|
|
||||||
|
|
||||||
# Run the application.
|
|
||||||
CMD pnpm start
|
|
17
compose.yaml
17
compose.yaml
|
@ -1,17 +0,0 @@
|
||||||
services:
|
|
||||||
server:
|
|
||||||
user: root
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
env_file:
|
|
||||||
- stack.env
|
|
||||||
volumes:
|
|
||||||
- courses:/usr/src/app/public/courses
|
|
||||||
- data:/usr/src/app/data
|
|
||||||
ports:
|
|
||||||
- 6547:6547
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
courses:
|
|
||||||
data:
|
|
18
config.example.js
Normal file
18
config.example.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
module.exports = {
|
||||||
|
/* Set true for production database */
|
||||||
|
production: true,
|
||||||
|
/* Your domain without / at the end */
|
||||||
|
domain: "http://localhost:6547",
|
||||||
|
/* Port for the server */
|
||||||
|
port: 6547,
|
||||||
|
/* How often can user send request to API */
|
||||||
|
rateLimitTime: 1000 * 5, // 5 seconds
|
||||||
|
/* How often can user change IP address */
|
||||||
|
ipChangeTime: 1000 * 60 * 60 * 3, // 3 hours
|
||||||
|
/* Your SteamAPI key */
|
||||||
|
steamKey: "",
|
||||||
|
/* Secret for a cookie */
|
||||||
|
cookieSecret: "",
|
||||||
|
/* Discord webhook url or leave empty */
|
||||||
|
webhook_url: "",
|
||||||
|
};
|
|
@ -8,7 +8,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"daisyui": "^4.11.1",
|
"daisyui": "^4.11.1",
|
||||||
"dotenv": "^16.4.5",
|
|
||||||
"ejs": "^2.6.1",
|
"ejs": "^2.6.1",
|
||||||
"express": "^4.16.1",
|
"express": "^4.16.1",
|
||||||
"express-session": "^1.18.0",
|
"express-session": "^1.18.0",
|
||||||
|
|
|
@ -11,9 +11,6 @@ importers:
|
||||||
daisyui:
|
daisyui:
|
||||||
specifier: ^4.11.1
|
specifier: ^4.11.1
|
||||||
version: 4.11.1(postcss@8.4.36)
|
version: 4.11.1(postcss@8.4.36)
|
||||||
dotenv:
|
|
||||||
specifier: ^16.4.5
|
|
||||||
version: 16.4.5
|
|
||||||
ejs:
|
ejs:
|
||||||
specifier: ^2.6.1
|
specifier: ^2.6.1
|
||||||
version: 2.6.2
|
version: 2.6.2
|
||||||
|
@ -398,10 +395,6 @@ packages:
|
||||||
domutils@3.1.0:
|
domutils@3.1.0:
|
||||||
resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==}
|
resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==}
|
||||||
|
|
||||||
dotenv@16.4.5:
|
|
||||||
resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
|
|
||||||
eastasianwidth@0.2.0:
|
eastasianwidth@0.2.0:
|
||||||
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
|
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
|
||||||
|
|
||||||
|
@ -1586,8 +1579,6 @@ snapshots:
|
||||||
domelementtype: 2.3.0
|
domelementtype: 2.3.0
|
||||||
domhandler: 5.0.3
|
domhandler: 5.0.3
|
||||||
|
|
||||||
dotenv@16.4.5: {}
|
|
||||||
|
|
||||||
eastasianwidth@0.2.0: {}
|
eastasianwidth@0.2.0: {}
|
||||||
|
|
||||||
ee-first@1.1.1: {}
|
ee-first@1.1.1: {}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
PROD=true
|
|
||||||
DOMAIN=http://localhost:6547
|
|
||||||
PORT=6547
|
|
||||||
RATELIMIT=5000
|
|
||||||
IPCHANGETIME=10800000
|
|
||||||
STEAMKEY=NO_KEY
|
|
||||||
COOKIE=NO_COOKIE
|
|
||||||
WEBHOOK=""
|
|
Loading…
Reference in a new issue