From cf615c71bc91f2393a2fc23e39d131ec616302d1 Mon Sep 17 00:00:00 2001 From: Clemens Elflein Date: Fri, 4 Oct 2024 16:27:20 +0200 Subject: [PATCH] wip --- .github/workflows/ci.yaml | 48 +++++++++++++++++++++++++++++++--- host-software/.dockerignore | 4 +++ host-software/.gitignore | 3 +++ host-software/Dockerfile | 15 +++++++++++ host-software/requirements.txt | 1 + 5 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 host-software/.dockerignore create mode 100644 host-software/.gitignore create mode 100644 host-software/Dockerfile create mode 100644 host-software/requirements.txt diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0933dc1..856b91c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,12 +8,22 @@ on: - 'feature/*' jobs: - CI: + pre-commit: + name: "Run Pre-Commit Checks" runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1 + artifacts: + name: "Build Artifacts" + needs: pre-commit + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - uses: actions/setup-python@v5 - uses: pre-commit/action@v3.0.1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -36,3 +46,35 @@ jobs: with: name: bootloader path: artifacts/ + build-host-docker: + name: "Build Host Software Docker Image" + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./host-software + steps: + - uses: actions/checkout@v4 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + - name: Build and push + id: build-and-push + uses: docker/build-push-action@v5 + with: + context: host-software + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: true + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/host-software/.dockerignore b/host-software/.dockerignore new file mode 100644 index 0000000..05578b5 --- /dev/null +++ b/host-software/.dockerignore @@ -0,0 +1,4 @@ +.idea +.venv +Dockerfile +out diff --git a/host-software/.gitignore b/host-software/.gitignore new file mode 100644 index 0000000..70361ea --- /dev/null +++ b/host-software/.gitignore @@ -0,0 +1,3 @@ +.venv/ +.idea/ +out/ diff --git a/host-software/Dockerfile b/host-software/Dockerfile new file mode 100644 index 0000000..585d8ab --- /dev/null +++ b/host-software/Dockerfile @@ -0,0 +1,15 @@ +# Use the official Python image from the Docker Hub +FROM python:3.10 + +# Set the working directory for the container +WORKDIR /usr/src/app + +# Copy the current directory contents into the container at /usr/src/app +COPY . . + +# Install any dependencies specified in requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Command to run your Python script along with the specified arguments +WORKDIR /workdir +ENTRYPOINT ["python", "main.py"] diff --git a/host-software/requirements.txt b/host-software/requirements.txt new file mode 100644 index 0000000..50188e3 --- /dev/null +++ b/host-software/requirements.txt @@ -0,0 +1 @@ +tqdm==4.66.5