From 859da42ce9aa97481f48ff38156803a73f7f3434 Mon Sep 17 00:00:00 2001
From: sqozz <sqozz-git@geekify.de>
Date: Wed, 5 Jun 2024 14:50:37 +0200
Subject: [PATCH] Initial container definition

---
 .forgejo/workflows/build.yaml | 15 +++++++++++++++
 Dockerfile                    |  6 ++++++
 2 files changed, 21 insertions(+)
 create mode 100644 .forgejo/workflows/build.yaml
 create mode 100644 Dockerfile

diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml
new file mode 100644
index 0000000..5c1b5bc
--- /dev/null
+++ b/.forgejo/workflows/build.yaml
@@ -0,0 +1,15 @@
+on:
+  push:
+  schedule:
+    - cron: '0 0 * * *'
+jobs:
+  build:
+    runs-on: gitea-container-builder
+    steps:
+      - run: buildah login --username ${{ secrets.username }} --password ${{ secrets.password }} ${GITHUB_SERVER_URL}
+      - run: wget ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/raw/branch/${GITHUB_REF_NAME}/Dockerfile
+      - run: buildah build --isolation=chroot | tee container_id
+      - run: export WORKING_CONTAINER_ID=$(buildah from $(tail -n 1 container_id))
+      - run: env
+      - run: buildah run $(tail -n 1 container_id)-working-container esphome version
+      - run: buildah push $(tail -n 1 container_id) ${GITHUB_SERVER_URL/https:\/\//}/${GITHUB_REPOSITORY,,}:latest
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..0c1dd61
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,6 @@
+# hadolint ignore=DL3006
+FROM alpine:latest
+RUN apk add curl python3 py3-pip
+RUN rm -f /usr/lib/*/EXTERNALLY-MANAGED
+RUN pip install esphome
+RUN pip install -r <(curl -s https://raw.githubusercontent.com/esphome/esphome/main/requirements_optional.txt)