Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: normalizes and improves readability for container files #83

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 16 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,18 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest as python-base

ENV PYTHONUNBUFFERED=1 \
# prevents python creating .pyc files
PYTHONDONTWRITEBYTECODE=1 \
\
# pip
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
\
# poetry
# https://python-poetry.org/docs/configuration/#using-environment-variables
POETRY_VERSION=1.5.1 \
# make poetry install to this location
POETRY_HOME="/opt/poetry" \
# make poetry create the virtual environment in the project's root
# it gets named `.venv`
POETRY_VIRTUALENVS_IN_PROJECT=true \
# do not ask any interactive question
POETRY_NO_INTERACTION=1 \
\
# paths
# this is where our requirements + virtual environment will live
# Paths for the virtual environment and working directory
PYSETUP_PATH="/trestle-bot" \
VENV_PATH="/trestle-bot/.venv"

LABEL maintainer="Red Hat Product Security" \
summary="Trestle Bot"


# prepend poetry and venv to path
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
# Ensure we use the virtualenv
ENV PATH="$VENV_PATH/bin:$PATH"

RUN microdnf update -y \
&& microdnf install -y python3.9 git \
Expand All @@ -40,28 +23,36 @@ RUN microdnf update -y \

FROM python-base as dependencies

# install poetry - respects $POETRY_VERSION & $POETRY_HOME
ARG POETRY_VERSION=1.5.1

# https://python-poetry.org/docs/configuration/#using-environment-variables
ENV POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1

ENV PATH="$POETRY_HOME/bin:$PATH"

# install poetry - respects $POETRY_HOME
RUN python3.9 -m pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir poetry=="$POETRY_VERSION"

# Cache runtime deps
WORKDIR "/build"
COPY . "/build"

# Install runtime deps and install the project in non-editable mode.
RUN python -m venv $VENV_PATH && \
RUN python3.9 -m venv $VENV_PATH && \
. $VENV_PATH/bin/activate && \
poetry install --without tests,dev --no-root && \
poetry build -f wheel -n && \
pip install --no-cache-dir --no-deps dist/*.whl && \
rm -rf dist *.egg-info

# final image

FROM python-base as final

COPY --from=dependencies $PYSETUP_PATH $PYSETUP_PATH

# Add wrappers for entrypoints that provide support the actions
# Add wrappers for entrypoints that provide support for the actions
COPY ./actions/autosync/auto-sync-entrypoint.sh /
COPY ./actions/rules-transform/rules-transform-entrypoint.sh /
COPY ./actions/create-cd/create-cd-entrypoint.sh /
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Integration tests between different types of tasks classes."""
"""Tests that validate workflow outcomes by model type."""
Loading