Skip to content

Commit

Permalink
ci - docker needs python package
Browse files Browse the repository at this point in the history
  • Loading branch information
shellshock1953 committed Dec 29, 2023
1 parent 7715c60 commit 00d442e
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 61 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish

on:
release:
types: [published]

jobs:
publish-python-package:
name: Publish python package on PyPI
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Publish PyPi package
uses: code-specialist/pypi-poetry-publish@v1.2
with:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_REGISTRY_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# PUBLISH_REGISTRY: "https://test.pypi.org/simple/"
BRANCH: main # TODO
PACKAGE_DIRECTORY: ./dnull_mqtt/
PYTHON_VERSION: "3.10"

publish-docker-image:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs: publish-python-package
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: 2xnone/awtrix
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
37 changes: 0 additions & 37 deletions .github/workflows/disabled/build.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/pypi.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
FROM python:3.10


RUN pip install dnullproject-iot

WORKDIR /app/

CMD ["python", "dnull_mqtt"]
CMD ["awtrix-publisher"]
16 changes: 16 additions & 0 deletions Dockerfile.src
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.10

ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV POETRY_VIRTUALENVS_CREATE=false

RUN pip install poetry

WORKDIR /app/
COPY poetry.lock pyproject.toml /app/

RUN poetry install --no-root --only main

COPY ./ /app/

CMD ["python", "dnull_mqtt"]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
dnull-mqtt = "dnull_mqtt.main:run"
awtrix-publisher = "dnull_mqtt.main:run"

0 comments on commit 00d442e

Please sign in to comment.