New export target #4673
Replies: 1 comment
-
Off the top of my head I am not seing the benifit here. The specific environments to which folks would want to install the project might vary significantly from user to user. What would be the use cases you'd consider here? Further, if there is real community interest in this, you could consider creating a plugin. Personally, if I would want a simple build, I would do something like this (untested). And in either case not much really is dynamic for the "simple" case - so a documented template should suffice here. Otherwise trying to account for variations can get gnarly. Note that we also assume that the wheel is universal and dependencies do not require platform dependencies. Also note that these are using the root user, might want to add some user add logic too. Building from sourceFROM docker.io/python:3.9 AS build
RUN pip install build
COPY ./ /opt/src
WORKDIR /opt/src
RUN python -m build --wheel .
FROM docker.io/python:3.9
RUN useradd --create-home --system --home-dir /opt/app --uid 1000 app
USER 1000
WORKDIR /opt/app
COPY --from=build /opt/src/dist/*.whl /opt/app
RUN python -m venv .venv
RUN /opt/${APP}/.venv/bin/python -m pip install *.whl
RUN echo "export PATH=/opt/app/.venv/bin:$PATH" > /etc/environment
ENTRYPOINT ["/opt/app/.venv/bin/app-script-name"] Installing from published packageFROM docker.io/python:3.9
RUN useradd --create-home --system --home-dir /opt/app --uid 1000 app
USER 1000
WORKDIR /opt/app
RUN python -m venv .venv
RUN /opt/${APP}/.venv/bin/python -m pip install <PYPI PACKAGE NAME>
RUN echo "export PATH=/opt/app/.venv/bin:$PATH" > /etc/environment
ENTRYPOINT ["/opt/app/.venv/bin/app-script-name"] And yes, I am aware this is missing a use case for "installing from the lock file". However, Ideally I would like this to be a build config option (building on python-poetry/poetry-core#83). This could look something like this instead of having to install python -m build --wheel --config-setting=--enable-lock |
Beta Was this translation helpful? Give feedback.
-
Hi! I am new here so maybe this discussion is already open or even closed.
Is there any running work to add new export targets, for example, so poetry could export a simple Dockerfile?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions