From d10ac65365112514004e8c16ca9f1ed5bf68996e Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 20 Nov 2021 16:59:12 +0100 Subject: [PATCH] Add dockerfile --- Dockerfile | 13 +++++++++++++ tasks.py | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7a01c6b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM debian:bullseye AS downloader +WORKDIR /app +RUN apt-get update && apt-get install -y wget +ARG GECKODRIVER_VERSION="v0.30.0" +ARG GECKODRIVER_FILENAME="geckodriver-$GECKODRIVER_VERSION-linux64" +RUN wget -q https://github.com/mozilla/geckodriver/releases/download/v0.30.0/$GECKODRIVER_FILENAME.tar.gz && tar xvf $GECKODRIVER_FILENAME.tar.gz && rm $GECKODRIVER_FILENAME.tar.gz + +FROM python:3.10-slim-bullseye as final +RUN apt-get update && apt-get install -y firefox-esr +COPY --from=downloader /app/geckodriver /usr/local/bin/geckodriver +ARG OFX_VERSION +RUN pip install ofx-processor==$OFX_VERSION +CMD ["ynab", "lcl", "--download"] diff --git a/tasks.py b/tasks.py index 513aef7..43ae5e2 100644 --- a/tasks.py +++ b/tasks.py @@ -37,3 +37,15 @@ def publish(ctx): if username and password: args = f"--username {username} --password {password}" ctx.run(f"poetry publish --build {args}", pty=True, echo=False) + + +@task +def publish_docker(ctx): + with ctx.cd(BASE_DIR): + docker_image = "rg.fr-par.scw.cloud/crocmagnon/ynab" + ctx.run( + f"docker build --build-arg OFX_VERSION=$(poetry version -s) -t {docker_image} .", + pty=True, + echo=True, + ) + ctx.run(f"docker push {docker_image}", pty=True, echo=True)