diff --git a/Dockerfile b/Dockerfile index 0da355d..caa81e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11.6-slim-bookworm@sha256:fda05d00fc47a4133a1b65bdd89007facf4ec0fa5fb737a35652699b18029830 AS base +FROM python:3.12.2-slim-bookworm@sha256:eb53cb99a609b86da6e239b16e1f2aed5e10cfbc538671fc4631093a00f133f2 AS base # github metadata LABEL org.opencontainers.image.source=https://github.com/paullockaby/enphase-poller @@ -23,25 +23,29 @@ RUN apt-get -q update && apt-get install -y --no-install-recommends git # now become the app user to set up poetry and the versioning tool RUN pip3 install poetry dunamai --no-cache-dir && mkdir -p $APP_ROOT && chown 1000:100 $APP_ROOT -COPY --chown=1000:1000 . $APP_ROOT +COPY --chown=1000:1000 pyproject.toml poetry.lock entrypoint $APP_ROOT +RUN chmod +x $APP_ROOT/entrypoint -# update the version number of our application +# we have enough to install the application now USER app WORKDIR $APP_ROOT -RUN poetry version $(dunamai from git --dirty) - -# now install our application RUN poetry config virtualenvs.in-project true && \ poetry config virtualenvs.create true && \ - poetry install --without=dev --no-interaction + poetry install --without=dev --no-interaction --no-directory --no-root + +# now copy over the application +COPY --chown=1000:1000 src/$APP_NAME $APP_ROOT/$APP_NAME + +# update the version number of our application +COPY --chown=1000:1000 .git/ $APP_ROOT/.git +RUN poetry version $(dunamai from git --dirty) FROM base AS final # copy over our actual application COPY --from=builder --chown=0:0 $APP_ROOT/entrypoint /entrypoint COPY --from=builder --chown=0:0 $APP_ROOT/.venv $APP_ROOT/.venv -COPY --from=builder --chown=0:0 $APP_ROOT/src $APP_ROOT/src -RUN chmod +x /entrypoint +COPY --from=builder --chown=0:0 $APP_ROOT/$APP_NAME $APP_ROOT/$APP_NAME # set up the virtual environment ENV VIRTUALENV=$APP_ROOT/.venv diff --git a/poetry.lock b/poetry.lock index de07fa8..12f99d2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -225,13 +225,13 @@ typing = ["typing-extensions (>=4.8)"] [[package]] name = "identify" -version = "2.5.33" +version = "2.5.34" description = "File identification library for Python" optional = false python-versions = ">=3.8" files = [ - {file = "identify-2.5.33-py2.py3-none-any.whl", hash = "sha256:d40ce5fcd762817627670da8a7d8d8e65f24342d14539c59488dc603bf662e34"}, - {file = "identify-2.5.33.tar.gz", hash = "sha256:161558f9fe4559e1557e1bff323e8631f6a0e4837f7497767c1782832f16b62d"}, + {file = "identify-2.5.34-py2.py3-none-any.whl", hash = "sha256:a4316013779e433d08b96e5eabb7f641e6c7942e4ab5d4c509ebd2e7a8994aed"}, + {file = "identify-2.5.34.tar.gz", hash = "sha256:ee17bc9d499899bc9eaec1ac7bf2dc9eedd480db9d88b96d123d3b64a9d34f5d"}, ] [package.extras] @@ -316,13 +316,13 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pre-commit" -version = "3.6.0" +version = "3.6.1" description = "A framework for managing and maintaining multi-language pre-commit hooks." optional = false python-versions = ">=3.9" files = [ - {file = "pre_commit-3.6.0-py2.py3-none-any.whl", hash = "sha256:c255039ef399049a5544b6ce13d135caba8f2c28c3b4033277a788f434308376"}, - {file = "pre_commit-3.6.0.tar.gz", hash = "sha256:d30bad9abf165f7785c15a21a1f46da7d0677cb00ee7ff4c579fd38922efe15d"}, + {file = "pre_commit-3.6.1-py2.py3-none-any.whl", hash = "sha256:9fe989afcf095d2c4796ce7c553cf28d4d4a9b9346de3cda079bcf40748454a4"}, + {file = "pre_commit-3.6.1.tar.gz", hash = "sha256:c90961d8aa706f75d60935aba09469a6b0bcb8345f127c3fbee4bdc5f114cf4b"}, ] [package.dependencies]