Giter Site home page Giter Site logo

Comments (7)

yegle avatar yegle commented on July 1, 2024 1

Yes that would be all.

from fava-docker.

yegle avatar yegle commented on July 1, 2024

To minimize the image size, git is not part of the image anymore.

I would suggest to create your own image based on this image. You can use Debian 10 image as base, install git, then copy files in this image to the result image.

I'm not sure how familiar you are with Dockerfile, but I assume this is relatively straightforward. Let me know if you want an example.

from fava-docker.

ngoonee avatar ngoonee commented on July 1, 2024

Not very familiar, but from what I understand I would use two FROM (just like you do in your Dockerfile), and the 'real' FROM would be Debian or Alpine or something like that (where I'd install git), and from your image I'd just:-

  1. Copy /app
  2. Basically do all the env/entrypoint stuff which your Dockerfile does after copying /app

That sound about right?

from fava-docker.

ngoonee avatar ngoonee commented on July 1, 2024

So I tried a simple Dockerfile which looks like this:-

FROM yegle/fava:latest as built

FROM alpine:latest

COPY --from=built /app /app

RUN apk add --no-cache git python3 py3-setuptools py3-virtualenv

EXPOSE 5000

ENV BEANCOUNT_FILE ""
# Required by Click library.
# See https://click.palletsprojects.com/en/7.x/python3/
ENV LC_ALL "C.UTF-8"
ENV LANG "C.UTF-8"
ENV FAVA_HOST "0.0.0.0"
ENV PATH "/app/bin:$PATH"

ENTRYPOINT ["fava"]

It builds successfully (since it does almost nothing) but fava can't start with this error:-

Traceback (most recent call last):
  File "/app/bin/fava", line5, in <module>
    from fava.cli import main
ModuleNotFoundError: No module named 'fava'

Is there some venv stuff I'm missing?

from fava-docker.

yegle avatar yegle commented on July 1, 2024

Alpine probably won't work: it uses musl libc, which is not compatible with glibc. My image is built using glibc (beancount have some binary Python module)

I would suggest to use Debian slim as base image, install python3 and git, then copy /app from my image.

from fava-docker.

yegle avatar yegle commented on July 1, 2024

Also, you probably don't want to use the official Python image even if it's based on Debian. The code in my image is installed under a Python version specific directory (something like /app/lib/python-3.x, AFK so I might be wrong). If you install Python 3 in Debian 10, the version would match.

from fava-docker.

ngoonee avatar ngoonee commented on July 1, 2024

Ah, didn't think about glibc. This works then! For posterity:-

FROM yegle/fava:latest as built

FROM debian:buster-slim

COPY --from=built /app /app

RUN apt-get update && apt-get install -y \
  git \
  python3

EXPOSE 5000

ENV BEANCOUNT_FILE ""
# Required by Click library.
# See https://click.palletsprojects.com/en/7.x/python3/
ENV LC_ALL "C.UTF-8"
ENV LANG "C.UTF-8"
ENV FAVA_HOST "0.0.0.0"
ENV PATH "/app/bin:$PATH"

ENTRYPOINT ["fava"]

Thanks so much for your time and image!

from fava-docker.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.