Skip to content

Commit

Permalink
Feat: Add Docker image and build
Browse files Browse the repository at this point in the history
  • Loading branch information
lbesnard committed Nov 4, 2024
1 parent d69652b commit f9690e1
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/docker.yaml
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
30 changes: 30 additions & 0 deletions Dockerfile
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

0 comments on commit f9690e1

Please sign in to comment.