-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
22303 auth api poetry upgrade (#2919)
- Loading branch information
Showing
10 changed files
with
3,206 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,75 @@ | ||
FROM python:3.8.5-buster | ||
FROM python:3.8.16-bullseye as development_build | ||
|
||
ARG VCS_REF="missing" | ||
ARG BUILD_DATE="missing" | ||
|
||
ENV VCS_REF=${VCS_REF} | ||
ENV BUILD_DATE=${BUILD_DATE} | ||
ENV PORT=5001 | ||
|
||
LABEL org.label-schema.vcs-ref=${VCS_REF} \ | ||
org.label-schema.build-date=${BUILD_DATE} | ||
|
||
USER root | ||
|
||
# Create working directory | ||
RUN mkdir /opt/app-root && chmod 755 /opt/app-root | ||
WORKDIR /opt/app-root | ||
LABEL maintainer="BCROS" | ||
LABEL vendor="BCROS" | ||
|
||
# Install the requirements | ||
COPY ./requirements.txt . | ||
ARG APP_ENV \ | ||
UID=1000 \ | ||
GID=1000 | ||
|
||
RUN pip install --upgrade pip | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
ENV APP_ENV=${APP_ENV} \ | ||
PYTHONFAULTHANDLER=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONHASHSEED=random \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PIP_NO_CACHE_DIR=1 \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=1 \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
PIP_ROOT_USER_ACTION=ignore \ | ||
POETRY_VERSION=1.8.3 \ | ||
POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_CREATE=false \ | ||
POETRY_CACHE_DIR='/var/cache/pypoetry' \ | ||
POETRY_HOME='/usr/local' | ||
|
||
COPY . . | ||
SHELL ["/bin/bash", "-eo", "pipefail", "-c"] | ||
|
||
RUN pip install . | ||
RUN apt-get update && apt-get upgrade -y \ | ||
&& apt-get install --no-install-recommends -y \ | ||
bash \ | ||
build-essential \ | ||
curl \ | ||
git \ | ||
libpq-dev \ | ||
&& curl -sSL 'https://install.python-poetry.org' | python3 - \ | ||
&& poetry --version \ | ||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ | ||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* | ||
|
||
USER 1001 | ||
WORKDIR /code | ||
|
||
# Set Python path | ||
ENV PYTHONPATH=/opt/app-root/src | ||
RUN groupadd -g "${GID}" -r web \ | ||
&& useradd -d '/code' -g web -l -r -u "${UID}" web \ | ||
&& chown web:web -R '/code' | ||
|
||
ENTRYPOINT ["bash", "docker-entrypoint.sh"] | ||
COPY --chown=web:web ./poetry.lock ./pyproject.toml /code/ | ||
|
||
COPY --chown=web:web ./src /code/src | ||
COPY --chown=web:web ./README.md /code | ||
|
||
RUN --mount=type=cache,target="$POETRY_CACHE_DIR" \ | ||
echo "$APP_ENV" \ | ||
&& poetry version \ | ||
&& 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 | ||
|
||
USER web | ||
|
||
FROM development_build AS production_build | ||
COPY --chown=web:web . /code | ||
|
||
CMD gunicorn --bind 0.0.0.0:${PORT} --config /code/gunicorn_config.py wsgi:app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.