Skip to content

Commit

Permalink
Dockerfile (#471)
Browse files Browse the repository at this point in the history
* Dockerfile: add basic dockerfile that drops into a bash shell with cgt-calc on path from a pipx venv

* readme: add Docker install, build and usage instructions

* readme: fix path string

* Dockerfile: workaround for #470 removed, since now addressed

* README: add empty line (apply the patch from the poetry pre-commit)
  • Loading branch information
deed02392 committed Feb 5, 2024
1 parent 432d241 commit 5880163
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM alpine:edge

RUN apk --no-cache add \
inkscape \
make \
ncurses \
pandoc-cli \
perl \
py3-pygments \
py3-boto3 \
py3-requests \
python3 \
texlive \
texlive-luatex \
texmf-dist \
texmf-dist-formatsextra \
texmf-dist-latexextra \
texmf-dist-pictures \
texmf-dist-science \
wget


RUN luaotfload-tool --update
RUN apk --no-cache add py3-pandas
RUN apk --no-cache add pipx
RUN pipx install cgt-calc
RUN pipx ensurepath

WORKDIR /data

ENTRYPOINT ["/bin/bash"]
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pipx install cgt-calc

- Python 3.8 or above.
- `pdflatex` is required to generate the report.
- [Optional] Docker

## Install LaTeX

Expand All @@ -42,6 +43,27 @@ apt install texlive-latex-base

[Install MiKTeX.](https://miktex.org/download)

### Docker

These steps will build and run the calculator in a self-contained environment, in case you would rather not have a systemwide LaTeX installation (or don't want to interfere with an existing one).
The following steps are tested on an Apple silicon Mac and may need to be slightly modified on other platforms.
With the cloned repository as the current working directory:

```shell
$ docker buildx build --platform linux/amd64 --tag capital-gains-calculator
```

Now you've built and tagged the calculator image, you can drop into a shell with `cgt-calc` installed on `$PATH`. Navigate to where you store your transaction data, and run:

```shell
$ cd ~/Taxes/Transactions
$ docker run --rm -it -v "$PWD":/data capital-gains-calculator:latest
a4800eca1914:/data# cgt-calc [...]
```

This will create a temporary Docker container with the current directory on the host (where your transaction data is) mounted inside the container at `/data`. Follow the usage instructions below as normal,
and when you're done, simply exit the shell. You will be dropped back into the shell on your host, with your output report pdf etc..

## Usage

You will need several input files:
Expand Down

0 comments on commit 5880163

Please sign in to comment.