-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): sync changes with nr-spar (#64)
Co-authored-by: Márcio Nemec <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: ronrobb <[email protected]> Co-authored-by: ronrobb <[email protected]> Co-authored-by: Ricardo Campos <[email protected]> Co-authored-by: Craig Yu <[email protected]> Co-authored-by: DustyD <[email protected]> Co-authored-by: Xiao Peng <[email protected]> Co-authored-by: mgaseta <[email protected]>
- Loading branch information
1 parent
0fed4f0
commit cab7bdf
Showing
14 changed files
with
571 additions
and
2,082 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 |
---|---|---|
|
@@ -39,6 +39,3 @@ jest.* | |
.vscode | ||
.ps1 | ||
thumbs.db | ||
|
||
venv/** | ||
.venv/** |
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,63 +1,24 @@ | ||
# ----------------- STAGE 1 ----------------- | ||
FROM python:3.13-slim-bookworm as base | ||
# using slim for development as the wheels are not always compat with | ||
# alpine, and builds can be slow as a result | ||
# FROM python:3.12-slim as base | ||
FROM python:3.13-slim | ||
|
||
ARG DEV=false | ||
ENV VIRTUAL_ENV=/app/docker_venv \ | ||
PATH="/app/docker_venv/bin:$PATH" | ||
# Receive build number as argument, retain as environment variable | ||
ARG BUILD_NUMBER | ||
ENV BUILD_NUMBER=${BUILD_NUMBER} | ||
|
||
# ----------------- STAGE 2 ----------------- | ||
FROM base as builder | ||
WORKDIR /app | ||
|
||
# Mostly config for poetry | ||
# - disable prompting | ||
# - disable virtualenv creation | ||
# - specify the path to the venv | ||
ENV POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=0 \ | ||
POETRY_VIRTUALENVS_CREATE=0 \ | ||
POETRY_CACHE_DIR=/tmp/poetry_cache \ | ||
VIRTUAL_ENV=/app/docker_venv \ | ||
PATH="/app/docker_venv/bin:$PATH" | ||
|
||
# install build tools, and dev libs required to compile postgres stuff | ||
# ideally these are not going to be used as for most of the libs | ||
# there are wheels available, however they are available in case we | ||
# need to compile something | ||
# Packages and nonroot user | ||
RUN apt update && \ | ||
apt install -y --no-install-recommends gcc libpq-dev python3-dev && \ | ||
useradd -M nonroot | ||
|
||
# Install Poetry to global python env | ||
RUN pip install poetry==1.8.4 | ||
|
||
# Grab the app dependency declarations | ||
COPY pyproject.toml poetry.lock ./ | ||
|
||
# create the venv in $VIRTUAL_ENV so we can control where it is being created | ||
# unfortunately this is the only way that we can control the venv that | ||
# poetry will use, is to create it ourselves | ||
RUN python -m venv $VIRTUAL_ENV; . $VIRTUAL_ENV/bin/activate | ||
# Disable cache, disable upgrade message, don't write .pyc files | ||
ENV PIP_NO_CACHE_DIR="1" | ||
ENV PIP_DISABLE_PIP_VERSION_CHECK="1" | ||
ENV PYTHONDONTWRITEBYTECODE="1" | ||
|
||
# have created and activated the venv, now install the dependencies into it | ||
RUN poetry install --without dev --no-root -v && rm -rf $POETRY_CACHE_DIR | ||
|
||
# ----------------- STAGE 3 ----------------- | ||
FROM base as runtime | ||
# Copy files and install requirements | ||
WORKDIR /app | ||
COPY . ./ | ||
RUN pip install -r ./requirements.txt --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org | ||
|
||
|
||
# install the postgres client, required by psycopg2 | ||
RUN apt update && apt install -y --no-install-recommends postgresql-client | ||
|
||
# only copy over the venv from the builder stage | ||
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} | ||
|
||
# RUN apk add bash | ||
COPY src /app/src | ||
COPY config /app/config | ||
|
||
CMD ["python", "src/main.py"] | ||
# Start the app | ||
USER nonroot | ||
CMD ["python3", "/app/src/main.py"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#cx-Oracle==8.3.0 | ||
oracledb | ||
numpy==2.2.2 | ||
pandas==2.2.3 | ||
psycopg2==2.9.10 | ||
SQLAlchemy==2.0.34 | ||
pyyaml==6.0.2 |
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.
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[loggers] | ||
keys=root | ||
|
||
[handlers] | ||
keys=stream_handler | ||
|
||
[formatters] | ||
keys=sample_formatter | ||
|
||
[logger_root] | ||
level=INFO | ||
handlers=stream_handler | ||
|
||
[handler_stream_handler] | ||
class=StreamHandler | ||
formatter=sample_formatter | ||
args=(sys.stdout,) | ||
|
||
[formatter_sample_formatter] | ||
format=%(levelname)s: %(asctime)s: %(module)s - %(message)s | ||
datefmt=%Y-%m-%d %H:%M:%S | ||
|
Oops, something went wrong.