Compare commits

..

4 Commits

Author SHA1 Message Date
8274067eef fix: Chef cook uses wrong toolchain
All checks were successful
Build and deploy / build (push) Successful in 12m58s
Build and deploy / Deploy container (push) Has been skipped
This adds a toolchain setup step to the base image so we do not have to
do it multiple times
2025-11-17 03:09:48 +01:00
4475ba5293 chore: Upgraded to new workflow
Some checks failed
Build and deploy / build (push) Failing after 17m55s
Build and deploy / Deploy container (push) Has been skipped
2025-11-16 23:25:47 +01:00
f3de8e36ea fix: Frontdoor presence is the wrong way around
All checks were successful
Build and deploy / build (push) Successful in 14m48s
Build and deploy / Deploy container (push) Successful in 1m59s
2025-10-30 20:56:49 +01:00
44f2c57819 fix: Set entrypoint lua path correctly in Dockerfile
All checks were successful
Build and deploy / build (push) Successful in 11m27s
Build and deploy / Deploy container (push) Successful in 29s
2025-10-22 05:17:02 +02:00
4 changed files with 53 additions and 21 deletions

View File

@@ -9,10 +9,10 @@ on:
jobs: jobs:
build: build:
uses: dreaded_x/workflows/.gitea/workflows/rust-kubernetes.yaml@22ee0c1788a8d2157db87d6a6f8dbe520fe48592 uses: dreaded_x/workflows/.gitea/workflows/docker-kubernetes.yaml@2be45c8128b7ccec93c49e69e807bb20727ca56b
secrets: inherit secrets: inherit
with: with:
upload_manifests: false push_manifests: false
deploy: deploy:
name: Deploy container name: Deploy container

View File

@@ -3,6 +3,8 @@ ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
RUN cargo install cargo-chef --locked --version 0.1.71 && \ RUN cargo install cargo-chef --locked --version 0.1.71 && \
cargo install cargo-auditable --locked --version 0.6.6 cargo install cargo-auditable --locked --version 0.6.6
WORKDIR /app WORKDIR /app
COPY ./rust-toolchain.toml .
RUN rustup toolchain install
FROM base AS planner FROM base AS planner
COPY . . COPY . .
@@ -21,5 +23,7 @@ RUN cargo auditable build --release
FROM gcr.io/distroless/cc-debian12:nonroot AS runtime FROM gcr.io/distroless/cc-debian12:nonroot AS runtime
COPY --from=builder /app/target/release/automation /app/automation COPY --from=builder /app/target/release/automation /app/automation
ENV AUTOMATION__ENTRYPOINT=/app/config/config.lua
ENV LUA_PATH="/app/?.lua;;"
COPY ./config /app/config COPY ./config /app/config
CMD [ "/app/automation" ] CMD [ "/app/automation" ]

View File

@@ -59,26 +59,21 @@ function module.setup(mqtt_client)
}) })
hallway_automation.set_trash(trash) hallway_automation.set_trash(trash)
---@param duration number local timeout = utils.Timeout.new()
---@return fun(_, open: boolean) local function frontdoor_presence(_, open)
local function frontdoor_presence(duration) if open then
local timeout = utils.Timeout.new() timeout:cancel()
return function(_, open) if not presence.overall_presence() then
if open then mqtt_client:send_message(helper.mqtt_automation("presence/contact/frontdoor"), {
timeout:cancel() state = true,
updated = utils.get_epoch(),
if presence.overall_presence() then })
mqtt_client:send_message(helper.mqtt_automation("presence/contact/frontdoor"), {
state = true,
updated = utils.get_epoch(),
})
end
else
timeout:start(duration, function()
mqtt_client:send_message(helper.mqtt_automation("presence/contact/frontdoor"), nil)
end)
end end
else
timeout:start(debug.debug_mode and 10 or 15 * 60, function()
mqtt_client:send_message(helper.mqtt_automation("presence/contact/frontdoor"), nil)
end)
end end
end end
@@ -89,7 +84,7 @@ function module.setup(mqtt_client)
topic = helper.mqtt_z2m("hallway/frontdoor"), topic = helper.mqtt_z2m("hallway/frontdoor"),
client = mqtt_client, client = mqtt_client,
callback = { callback = {
frontdoor_presence(debug.debug_mode and 10 or 15 * 60), frontdoor_presence,
hallway_automation.door_callback, hallway_automation.door_callback,
}, },
battery_callback = battery.callback, battery_callback = battery.callback,

33
docker-bake.hcl Normal file
View File

@@ -0,0 +1,33 @@
variable "TAG_BASE" {}
variable "RELEASE_VERSION" {}
group "default" {
targets = ["automation"]
}
target "docker-metadata-action" {}
# TODO: Auto include this from the workflow
target "common" {
cache-from = [
{
type = "gha"
}
]
cache-to = [
{
type = "gha"
mode = "max"
}
]
args = {
RELEASE_VERSION = "${RELEASE_VERSION}"
}
}
target "automation" {
inherits = ["docker-metadata-action", "common"]
context = "./"
dockerfile = "Dockerfile"
tags = [for tag in target.docker-metadata-action.tags : "${TAG_BASE}:${tag}"]
}