-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
2 changed files
with
61 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Build Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:latest |
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,30 @@ | ||
FROM python:3.12-slim | ||
|
||
# Set environment variables for Poetry | ||
ENV POETRY_VERSION=1.6.1 \ | ||
POETRY_VIRTUALENVS_CREATE=true \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
POETRY_HOME="/opt/poetry" | ||
|
||
# Install Poetry and dependencies | ||
RUN apt-get update && apt-get install -y curl && \ | ||
curl -sSL https://install.python-poetry.org | python3 - && \ | ||
ln -s ${POETRY_HOME}/bin/poetry /usr/local/bin/poetry | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
COPY poetry.lock pyproject.toml /app/ | ||
|
||
# Install dependencies | ||
RUN poetry install --no-interaction --no-root | ||
|
||
COPY . /app | ||
|
||
# Install the project | ||
RUN poetry install --no-interaction | ||
|
||
# Run tests and verify the package build | ||
RUN poetry run pytest && \ | ||
poetry build && \ | ||
pip install dist/*.whl |