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

Fix notebook report poetry #1853

Merged
merged 4 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
62 changes: 58 additions & 4 deletions jobs/notebook-report/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,77 @@ ARG BUILD_DATE="missing"

ENV VCS_REF=${VCS_REF}
ENV BUILD_DATE=${BUILD_DATE}
ENV PORT=8080

LABEL org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.build-date=${BUILD_DATE}

USER root

LABEL maintainer="travissemple"
LABEL vendor="BCROS"

ARG APP_ENV \
# Needed for fixing permissions of files created by Docker:
UID=1000 \
GID=1000

ENV APP_ENV=${APP_ENV} \
# python:
PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PYTHONDONTWRITEBYTECODE=1 \
# pip:
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_DEFAULT_TIMEOUT=100 \
PIP_ROOT_USER_ACTION=ignore \
# poetry:
POETRY_VERSION=1.8.3 \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_CACHE_DIR='/var/cache/pypoetry' \
POETRY_HOME='/usr/local'

SHELL ["/bin/bash", "-eo", "pipefail", "-c"]

RUN apt-get update && apt-get upgrade -y \
&& apt-get install --no-install-recommends -y \
bash \
brotli \
build-essential \
curl \
gettext \
git \
libpq-dev \
wait-for-it \
&& curl -sSL 'https://install.python-poetry.org' | python - \
&& poetry --version \
# Cleaning cache:
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

# Create working directory
RUN mkdir /opt/app-root && chmod 755 /opt/app-root
RUN mkdir /opt/app-root/data && chmod 777 /opt/app-root/data
WORKDIR /opt/app-root

# Install the requirements
COPY ./requirements.txt .

RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
COPY ./poetry.lock .
COPY ./pyproject.toml .

# Project initialization:
RUN --mount=type=cache,target="$POETRY_CACHE_DIR" \
echo "$APP_ENV" \
&& poetry version \
&& poetry config installer.max-workers 1 \
# Install deps:
&& poetry run pip install -U pip \
&& poetry install \
$(if [ -z ${APP_ENV+x} ] | [ "$APP_ENV" = 'production' ]; then echo '--only main'; fi) \
--no-interaction --no-ansi

COPY . .

USER 1001
Expand Down
23 changes: 5 additions & 18 deletions jobs/notebook-report/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ license: ## Verify source code license headers.
#################################################################################
# COMMANDS -- Setup #
#################################################################################
setup: install install-dev ## Setup the project
setup: install ## Setup the project

clean: clean-build clean-pyc clean-test ## Clean the project
rm -rf venv/
Expand All @@ -42,23 +42,10 @@ clean-test: ## clean test files
rm -f .coverage
rm -fr htmlcov/

build-req: clean ## Upgrade requirements
test -f venv/bin/activate || python3.8 -m venv $(CURRENT_ABS_DIR)/venv ;\
. venv/bin/activate ;\
pip install --upgrade pip ;\
pip install -Ur requirements/prod.txt ;\
pip freeze | sort > requirements.txt

install: clean ## Install python virtrual environment
test -f venv/bin/activate || python3.8 -m venv $(CURRENT_ABS_DIR)/venv ;\
. venv/bin/activate ;\
pip install --upgrade pip ;\
pip install -Ur requirements.txt

install-dev: ## Install local application
. venv/bin/activate ; \
pip install -Ur requirements/dev.txt; \
pip install -e .
install: clean
pip install poetry ;\
poetry config installer.max-workers 1
poetry install

#################################################################################
# COMMANDS - CI #
Expand Down
Loading
Loading