dockerize app

This commit is contained in:
William Diakite 2025-07-24 13:14:46 -04:00
parent a68ca93427
commit 1e363f6c66
8 changed files with 87 additions and 3 deletions

5
.docker-compose.yml Normal file
View file

@ -0,0 +1,5 @@
services:
cms:
image: alliances-cms
ports:
- "1111:1111"

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
node_modules

3
.env.development Normal file
View file

@ -0,0 +1,3 @@
TOKEN_SECRET_KEY="a very dark"
DB_CONNECTION=sqlite
DB_PATH=.manifest/db.sqlite

3
.env.production Normal file
View file

@ -0,0 +1,3 @@
TOKEN_SECRET_KEY="a very dark"
DB_CONNECTION=sqlite
DB_PATH=/app/.manifest/db.sqlite

20
Dockerfile Normal file
View file

@ -0,0 +1,20 @@
# Use the official Node.js image as a base
FROM node:18-slim
# Copy package.json and package-lock.json (if available)
COPY package*.json ./
# Install dependencies
RUN npm install && npm cache clean --force && rm -rf /root/.npm && rm -rf /tmp/*
# Copy the rest of your application code
COPY . .
# Set the NODE_ENV environment variable
ENV NODE_ENV=production
# Expose the port the app runs on (adjust as needed)
EXPOSE 1111
# Start the application
CMD ["npm", "run", "start"]

14
docker-compose.yml Normal file
View file

@ -0,0 +1,14 @@
services:
cms:
build: .
image: alliances-cms
ports:
- "1111:1111"
environment:
- NODE_ENV=production
- TOKEN_SECRET_KEY=${TOKEN_SECRET_KEY}
- DB_PATH=${DB_PATH}
env_file: .env.production
volumes:
- ./.manifest:/app/.manifest

35
package-lock.json generated
View file

@ -9,7 +9,11 @@
"version": "0.1.0",
"license": "UNLICENSED",
"dependencies": {
"manifest": "^4.16.2"
"manifest": "^4.16.2",
"sqlite3": "^5.1.7"
},
"devDependencies": {
"dotenv-cli": "^9.0.0"
}
},
"node_modules/@aws-crypto/crc32": {
@ -3346,6 +3350,35 @@
"url": "https://dotenvx.com"
}
},
"node_modules/dotenv-cli": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-9.0.0.tgz",
"integrity": "sha512-NhGrQum/u1VTBxnSnlNwVkTP3gojYO8T6Fntyru93wbR1hPo8aFhDFJiBPmkT0771i7f5Rd7EQDaOreS8jY8gA==",
"dev": true,
"license": "MIT",
"dependencies": {
"cross-spawn": "^7.0.6",
"dotenv": "^17.1.0",
"dotenv-expand": "^10.0.0",
"minimist": "^1.2.6"
},
"bin": {
"dotenv": "cli.js"
}
},
"node_modules/dotenv-cli/node_modules/dotenv": {
"version": "17.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.0.tgz",
"integrity": "sha512-Q4sgBT60gzd0BB0lSyYD3xM4YxrXA9y4uBDof1JNYGzOXrQdQ6yX+7XIAqoFOGQFOTK1D3Hts5OllpxMDZFONQ==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/dotenv-expand": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-10.0.0.tgz",

View file

@ -5,10 +5,15 @@
"private": true,
"license": "UNLICENSED",
"scripts": {
"start:dev": "dotenv -e .env.development -- node node_modules/manifest/scripts/watch/watch.js",
"start": "node node_modules/manifest/scripts/watch/watch.js",
"seed": "node node_modules/manifest/dist/manifest/src/seed/scripts/seed.js"
},
"dependencies": {
"manifest": "^4.16.2"
"manifest": "^4.16.2",
"sqlite3": "^5.1.7"
},
"devDependencies": {
"dotenv-cli": "^9.0.0"
}
}