diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5bb625f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Use an official Node.js runtime as a parent image +FROM node:22 + +# Don't run as root +USER node + +# Set the working directory in the container +WORKDIR /usr/src/app + +# Create the cache directory +RUN mkdir -p ./cache + +# Copy the current directory contents into the container at /usr/src/app +COPY .env *.js *.credentials package.json README.md LICENSE . + +# Install any needed packages specified in package.json +RUN npm install && npm update +# Define environment variable +ENV NODE_ENV=production + +# Run the app when the container launches +ENTRYPOINT ["tail", "-f", "/dev/null"] diff --git a/README.md b/README.md index 0da0971..20ef62d 100644 --- a/README.md +++ b/README.md @@ -228,3 +228,20 @@ $ node track-investments.js ``` It is recommended to run this script once per month. + + + +# Setup with Docker: +This guide assumes you already have a working version of docker installed and have cloned the repo to a location of your choice. + +Build the container image + +`docker build -t actual-helper ./` + +Test if the docker container works correctly. + +`docker run -itd --name actual-helper actual-helper ` + +`docker exec actual-helper node sync-banks.js` + +If it is working correctly the bank sync should run. diff --git a/example.env b/example.env new file mode 100644 index 0000000..66c6aed --- /dev/null +++ b/example.env @@ -0,0 +1,19 @@ +ACTUAL_SERVER_URL="https://" +ACTUAL_SERVER_PASSWORD="" +ACTUAL_SYNC_ID="" + +# optional, for encrypted files +ACTUAL_FILE_PASSWORD="" + +# optional, if you want to use a different cache directory +ACTUAL_CACHE_DIR="./cache" + +# optional, name of the payee for added interest transactions +INTEREST_PAYEE_NAME="Loan Interest" + +# optional, name of the payee for added interest transactions +INVESTMENT_PAYEE_NAME="Investment" +# optional, name of the cateogry group for added investment tracking transactions +INVESTMENT_CATEGORY_GROUP_NAME="Income" +# optional, name of the category for added investment tracking transactions +INVESTMENT_CATEGORY_NAME="Investment"