From 5048ffe9a3ddd9bc0beb8e441d557c00fc99a17d Mon Sep 17 00:00:00 2001 From: Charlie Collett Date: Fri, 30 Aug 2024 12:01:27 -0700 Subject: [PATCH] Reformat output for information --- Dockerfile | 44 +++++++++++++------------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index c07caf8..5790cfa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,15 @@ WORKDIR /app # Both build and development need poetry, so it is its own step. FROM base AS poetry + +# Print environment information +RUN echo -n "--------START ENVIRONMENT OUTPUT--------" +RUN echo -n "OS: " && cat /etc/os-release +# Print Debian version on the same line +RUN echo -n "FULL OS VERSION: " && hostnamectl | grep "Operating System" | awk '{print $3}' +# Print Python version on the same line +RUN echo -n "LANGUAGE: " && poetry run python --version + RUN pip install poetry # Use this page as a reference for python and poetry environment variables: @@ -40,61 +49,34 @@ RUN poetry install --no-root --without dev && rm -rf ${POETRY_CACHE_DIR}; FROM build AS test # Install dev dependencies RUN poetry install --only dev --no-root && rm -rf ${POETRY_CACHE_DIR}; +# Print Python dependencies on the same line with the list starting right after the title +RUN echo "--------DEPENDENCIES---------" && poetry run pip list && echo "--------DEPENDENCIES---------" COPY . . # Run tests USER app RUN poetry run pytest tests -# Print environment information -RUN echo -n "--------START ENVIRONMENT OUTPUT--------" -RUN echo -n "OS: " && cat /etc/os-release -# Print Debian version on the same line -RUN echo -n "Debian Version: " && cat /etc/debian_version -# Print Python version on the same line -RUN echo -n "LANGUAGE: " && poetry run python --version -# Print Python dependencies on the same line with the list starting right after the title -RUN echo "DEPENDENCIES:" && poetry run pip list -RUN echo -n "--------END ENVIRONMENT OUTPUT--------" FROM poetry AS build-unlocked-test COPY pyproject.toml ./ RUN poetry install --no-root && rm -rf ${POETRY_CACHE_DIR}; +RUN echo "--------DEPENDENCIES---------" && poetry run pip list && echo "--------DEPENDENCIES---------" COPY . . # Run tests USER app RUN poetry run pytest tests -# Print environment information -RUN echo -n "--------START ENVIRONMENT OUTPUT--------" -RUN echo -n "OS: " && cat /etc/os-release -# Print Debian version on the same line -RUN echo -n "Debian Version: " && cat /etc/debian_version -# Print Python version on the same line -RUN echo -n "LANGUAGE: " && poetry run python --version -# Print Python dependencies on the same line with the list starting right after the title -RUN echo "DEPENDENCIES:" && poetry run pip list -RUN echo -n "--------END ENVIRONMENT OUTPUT--------" FROM poetry AS build-latest-test COPY pyproject.toml ./ RUN sed -i 's/\^/>=/g' pyproject.toml RUN poetry install --no-root && rm -rf ${POETRY_CACHE_DIR}; +RUN echo "--------DEPENDENCIES---------" && poetry run pip list && echo "--------DEPENDENCIES---------" COPY . . # Run tests USER app RUN poetry run pytest tests -# Print environment information -RUN echo -n "--------START ENVIRONMENT OUTPUT--------" -RUN echo -n "OS: " && cat /etc/os-release -# Print Debian version on the same line -RUN echo -n "Debian Version: " && cat /etc/debian_version -# Print Python version on the same line -RUN echo -n "LANGUAGE: " && poetry run python --version -# Print Python dependencies on the same line with the list starting right after the title -RUN echo "DEPENDENCIES:" && poetry run pip list -RUN echo -n "--------END ENVIRONMENT OUTPUT--------" - FROM base AS production RUN mkdir -p /venv && chown ${UID}:${GID} /venv