Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cache to be retained between images (volume mount), improve Docker image metadata #31

Merged
merged 13 commits into from
Feb 18, 2024
17 changes: 15 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,25 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Determine image version
# shell: bash
run: |
if [[ $GITHUB_EVENT_NAME == "pull_request" ]]; then
echo "IMAGE_VERSION=${{ env.GitVersion_MajorMinorPatch }}-beta" >> $GITHUB_ENV
else
echo "IMAGE_VERSION=${{ env.GitVersion_MajorMinorPatch }}" >> $GITHUB_ENV
fi

- name: Build and push (PR)
uses: docker/build-push-action@v5
if: github.event_name == 'pull_request'
with:
push: true
tags: |
dickwolff/export-to-ghostfolio:${{ env.GitVersion_MajorMinorPatch }}-beta
dickwolff/export-to-ghostfolio:${{ env.IMAGE_VERSION }}
build-args: |
IMAGE_VERSION=${{ env.IMAGE_VERSION }}

- name: Build and push (main)
uses: docker/build-push-action@v5
Expand All @@ -60,6 +71,8 @@ jobs:
push: true
tags: |
dickwolff/export-to-ghostfolio:latest
dickwolff/export-to-ghostfolio:${{ env.GitVersion_MajorMinorPatch }}
dickwolff/export-to-ghostfolio:${{ env.IMAGE_VERSION }}
build-args: |
IMAGE_VERSION=${{ env.IMAGE_VERSION }}


2 changes: 2 additions & 0 deletions .github/workflows/frameworkTesting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
- run: npm install

- run: npm run test
env:
E2G_CACHE_FOLDER: 'tmp/e2g-cache'

- name: Convert code coverage results for summary
uses: irongut/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pids
logs
results
tmp
var

# Coverage reports
coverage
Expand Down
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
FROM node:20-alpine3.19

WORKDIR /app

ARG IMAGE_VERSION

LABEL name="Export to Ghostfolio"
LABEL description="Convert transaction history export from your favorite broker to a format that can be imported in Ghostfolio."
LABEL author="Dick Wolff"
LABEL version="$IMAGE_VERSION"

COPY . .

RUN npm install

RUN mkdir /var/e2g-input
RUN mkdir /var/e2g-output
RUN mkdir /var/e2g-cache

ENTRYPOINT [ "npm" ]
CMD ["run", "watch"]
CMD ["run", "watch"]
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 0.5.1
next-version: 0.5.2
assembly-informational-format: "{NuGetVersion}"
mode: ContinuousDeployment
branches:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ The following parameters can be given to the Docker run command.
| ------- | -------- | ----------- |
| ` -v {local_in-folder}:/var/e2g-input` | N | The input folder where you put the files to be processed |
| `-v {local_out_folder}:/var/e2g-output` | N | The output folder where the Ghostfolio import JSON will be placed. Also the input file will be moved here when an error ocurred while processing the file. |
| `-v {local_cache_folder}:/var/e2g-cache` | Y | The folder where Yahoo Finance symbols will be cached |
| `--env GHOSTFOLIO_ACCOUNT_ID=xxxxxxx` | N | Your Ghostolio account ID <sup>1</sup> |
| `--env USE_POLLING=true` | Y | When set to true, the container will continously look for new files to process and the container will not stop. |
| `--env DEBUG_LOGGING=true` | Y | When set to true, the container will show logs in more detail, useful for error tracing. |
Expand Down
2 changes: 1 addition & 1 deletion src/yahooFinanceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as cacache from "cacache";
import yahooFinance from 'yahoo-finance2';
import { YahooFinanceRecord } from './models/yahooFinanceRecord';

const cachePath = "tmp/e2g-cache";
const cachePath = process.env.E2G_CACHE_FOLDER || "/var/e2g-cache";

export class YahooFinanceService {

Expand Down
Loading