From 0ae3bda8be60c5a226e584996825550624d9f412 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 5 Nov 2025 11:56:16 -0500 Subject: [PATCH] feat: Dockerize application and add features - Add Dockerfile, .dockerignore, and docker-compose.yml to containerize the application. - Update server.js to use a data directory for the database. - Add SweetAlert for improved user experience. - Add date filtering to the transactions page. - Fix bug with saving split transactions. --- .dockerignore | 4 + .gitignore | 3 + Dockerfile | 20 ++ docker-compose.yml | 10 + index.html | 765 +++++++++++++++++++++++++++++++-------------- server.js | 367 +++++++++++++++++----- 6 files changed, 853 insertions(+), 316 deletions(-) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5b26a93 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +debug.log +.git +.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f06070 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +simpleledger.db +debug.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e73d8a2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Node.js runtime as a parent image +FROM node:18-alpine + +# Set the working directory in the container +WORKDIR /usr/src/app + +# Copy package.json and package-lock.json to the working directory +COPY package*.json ./ + +# Install app dependencies +RUN npm install + +# Copy the rest of the application files to the working directory +COPY . . + +# Make port 3000 available to the world outside this container +EXPOSE 3000 + +# Define the command to run your app +CMD [ "node", "server.js" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..214b0d2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + app: + build: . + ports: + - "3001:3000" + volumes: + - ./ledger_db:/usr/src/app/data + +volumes: + ledger_db: diff --git a/index.html b/index.html index c190f00..185496d 100644 --- a/index.html +++ b/index.html @@ -4,10 +4,9 @@ SimpleLedger - Your Personal Bookkeeper - - +