Compile version into application file rather using the env
@@ -7,6 +7,16 @@ RUN pip install pipenv
COPY Pipfile* ./
RUN pipenv install --deploy
+# Create __version__ from $APP_VERSION
+FROM base AS version
+ARG APP_VERSION=$APP_VERSION
+ENV APP_VERSION=$APP_VERSION
+
+RUN mkdir -p /app/plex_trakt_sync
+RUN echo "__version__ = '$APP_VERSION'" > plex_trakt_sync/__init__.py
+RUN cat plex_trakt_sync/__init__.py
+RUN python -c "from plex_trakt_sync import __version__; print(__version__)"
+
FROM base
ENTRYPOINT ["python", "-m", "plex_trakt_sync"]
@@ -21,7 +31,5 @@ VOLUME /app/config
# Copy things together
COPY . .
+COPY --from=version /app/plex_trakt_sync/__init__.py plex_trakt_sync/
COPY --from=build /root/.local/share/virtualenvs/app-*/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
-
-ARG APP_VERSION=$APP_VERSION
-ENV APP_VERSION=$APP_VERSION
\ No newline at end of file
