Skip to content

Commit

Permalink
adjusted volume bind for staging/prod
Browse files Browse the repository at this point in the history
  • Loading branch information
BodomBeach committed May 30, 2024
1 parent dcc3084 commit 18f67fa
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
git pull
docker system prune -f
docker compose down
docker compose -f compose.yaml -f compose.prod.yaml up --build -d
docker compose -f compose.prod.yaml up --build -d
2 changes: 1 addition & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
git pull
docker system prune -f
docker compose down
docker compose -f compose.yaml -f compose.prod.yaml up --build -d
docker compose -f compose.prod.yaml up --build -d
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ RUN apt-get update && apt-get install gnupg wget -y && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app
RUN chown -R node /app
USER node
RUN mkdir /db
RUN chown -R node:node /db

COPY package.json package.json
COPY package-lock.json package-lock.json
RUN npm ci --include=dev

COPY . .

USER node

CMD npm run dev
7 changes: 6 additions & 1 deletion compose.prod.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
services:
app:
build:
context: .
command: npm run start
restart: unless-stopped
environment:
- NODE_ENV=production
- NODE_ENV=production
volumes:
- ./db:/app/db
3 changes: 1 addition & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ services:
command: npm run dev
restart: unless-stopped
volumes:
- .:/app
- /app/node_modules # Avoid overwriting node_modules of main bind (.:/app)
- .:/app
Empty file added db/a
Empty file.
2 changes: 1 addition & 1 deletion src/utils/initDb.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const sqlite3 = require('sqlite3').verbose();

const db = new sqlite3.Database('db.sqlite', (err) => {
const db = new sqlite3.Database('db/db.sqlite', (err) => {
if (err) {
console.error("Error opening database:", err.message);
return;
Expand Down

0 comments on commit 18f67fa

Please sign in to comment.