-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ec6bc8
commit 2e79473
Showing
17 changed files
with
1,728 additions
and
53 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
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,21 @@ | ||
name: Python tests | ||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Run image | ||
uses: abatilo/actions-poetry@v2 | ||
with: | ||
poetry-version: '1.3.2' | ||
- name: Install dependencies | ||
run: poetry install | ||
- name: Run tests | ||
run: poetry run pytest |
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,8 +1,95 @@ | ||
FROM python:3.9.12-bullseye | ||
# Reference: https://bmaingret.github.io/blog/2021-11-15-Docker-and-Poetry#multi-stage-build | ||
|
||
COPY . /publisher | ||
WORKDIR /publisher | ||
ARG APP_NAME=example-publisher | ||
ARG APP_PACKAGE=example_publisher | ||
ARG APP_PATH=/opt/$APP_NAME | ||
ARG PYTHON_VERSION=3.10.4 | ||
ARG POETRY_VERSION=1.2.2 | ||
|
||
RUN pip install --upgrade setuptools pip && pip install -e . | ||
# | ||
# Stage: base | ||
# | ||
|
||
CMD ["python", "-m", "publisher", "--config", "config/config.toml"] | ||
FROM python:$PYTHON_VERSION as base | ||
|
||
ARG APP_NAME | ||
ARG APP_PATH | ||
ARG POETRY_VERSION | ||
|
||
ENV \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONFAULTHANDLER=1 | ||
ENV \ | ||
POETRY_VERSION=$POETRY_VERSION \ | ||
POETRY_HOME="/opt/poetry" \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
POETRY_NO_INTERACTION=1 | ||
|
||
# Install Poetry - respects $POETRY_VERSION & $POETRY_HOME | ||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python | ||
ENV PATH="$POETRY_HOME/bin:$PATH" | ||
|
||
WORKDIR $APP_PATH | ||
COPY . . | ||
|
||
# | ||
# Stage: development | ||
# | ||
|
||
FROM base as development | ||
|
||
ARG APP_NAME | ||
ARG APP_PATH | ||
|
||
WORKDIR $APP_PATH | ||
RUN poetry install | ||
|
||
ENV APP_NAME=$APP_NAME | ||
|
||
ENTRYPOINT ["poetry", "run"] | ||
CMD ["$APP_NAME"] | ||
|
||
# | ||
# Stage: build | ||
# | ||
|
||
FROM base as build | ||
|
||
ARG APP_NAME | ||
ARG APP_PATH | ||
|
||
WORKDIR $APP_PATH | ||
RUN poetry build --format wheel | ||
RUN poetry export --format requirements.txt --output constraints.txt --without-hashes | ||
|
||
# | ||
# Stage: production | ||
# | ||
|
||
FROM python:$PYTHON_VERSION as production | ||
|
||
ARG APP_NAME | ||
ARG APP_PATH | ||
|
||
ENV \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONFAULTHANDLER=1 | ||
|
||
ENV \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 | ||
|
||
# Get build artifact wheel and install it respecting dependency versions | ||
WORKDIR $APP_PATH | ||
COPY --from=build $APP_PATH/dist/*.whl ./ | ||
COPY --from=build $APP_PATH/constraints.txt ./ | ||
RUN pip install ./*.whl --requirement constraints.txt | ||
|
||
COPY ./entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["$APP_NAME"] |
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,5 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
eval "exec $@" |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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 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 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
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../test_pyth_replicator_manual_aggregate.py → .../test_pyth_replicator_manual_aggregate.py
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
Oops, something went wrong.