Add dockerfile

This commit is contained in:
Gabriel Augendre 2021-11-20 16:59:12 +01:00
parent 9ab6cd8e04
commit d10ac65365
2 changed files with 25 additions and 0 deletions

13
Dockerfile Normal file
View file

@ -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"]

View file

@ -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)