-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathDockerfile
More file actions
102 lines (89 loc) · 3.33 KB
/
Dockerfile
File metadata and controls
102 lines (89 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
ARG BUILD_FROM=ghcr.io/hassio-addons/debian-base:9.3.0
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Setup application directory
# App metadata (injected by CI)
ENV APP_VERSION="0.2.1"
ENV APP_NAME="SwitchCraft"
ENV APP_SLUG="switchcraft"
ENV APP_UNSUPPORTED="false"
WORKDIR /app
# Install dependencies (Python, Wine, Support)
# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
python3-dev \
build-essential \
wine \
unzip \
curl \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy rootfs
COPY rootfs /
# Ensure S6 scripts are executable
RUN chmod +x /etc/s6-overlay/s6-rc.d/switchcraft/run
# Install Python requirements and SwitchCraft
# renovate: datasource=github-tags depName=FaserF/SwitchCraft
ARG SWITCHCRAFT_VERSION="v2026.1.5b2"
# shellcheck disable=SC2102
# hadolint ignore=DL3013,SC2102
RUN curl -L -o /tmp/switchcraft.tar.gz https://github.com/FaserF/SwitchCraft/archive/refs/tags/${SWITCHCRAFT_VERSION}.tar.gz \
&& tar xf /tmp/switchcraft.tar.gz -C /app --strip-components=1 \
&& rm /tmp/switchcraft.tar.gz \
# Install dependencies (mirroring upstream Dockerfile)
&& pip3 install --break-system-packages --no-cache-dir .[web-server,ai] flet==0.80.4 flet-web==0.80.4 flet-charts==0.80.4 packaging \
# Generate Addons
&& python3 src/generate_addons.py \
# Install bundled addons
&& mkdir -p /root/.switchcraft/addons \
&& shopt -s nullglob \
&& for zip in /app/src/switchcraft/assets/addons/*.zip; do \
unzip -o "$zip" -d "/root/.switchcraft/addons/$(basename "$zip" .zip)"; \
done \
&& shopt -u nullglob
# Environment variables
ENV FLET_SERVER_IP=0.0.0.0
ENV FLET_SERVER_PORT=8080
ENV FLET_FORCE_WEB_SOCKET=true
ENV FLET_REMOTE_ADDR_HEADER=X-Forwarded-For
ENV FLET_WEB_URL=http://localhost:8080
ENV FLET_ENTRY_URL=http://localhost:8080
ENV SC_DISABLE_WINGET_INSTALL=1
# Symlink assets
RUN ln -s /app/src/switchcraft/assets /app/assets
# CR-Skip-PythonBaseCheck
# Build arguments
ARG BUILD_ARCH
ARG BUILD_DATE="1970-01-01T00:00:00Z"
ARG BUILD_DESCRIPTION
ARG BUILD_NAME
ARG BUILD_REF
ARG BUILD_REPOSITORY
ARG BUILD_VERSION
# Health Check
HEALTHCHECK --interval=30s --timeout=10s --retries=5 --start-period=30s \
CMD curl --fail http://127.0.0.1:8080 || exit 1
# Labels
LABEL \
io.hass.name="${BUILD_NAME}" \
io.hass.description="${BUILD_DESCRIPTION}" \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="addon" \
io.hass.version="${BUILD_VERSION}" \
maintainer="FaserF" \
org.opencontainers.image.title="${BUILD_NAME}" \
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
org.opencontainers.image.vendor="FaserF's Home Assistant Apps" \
org.opencontainers.image.authors="FaserF <https://github.com/FaserF>" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://github.com/FaserF/hassio-addons/tree/master/switchcraft" \
org.opencontainers.image.source="https://github.com/FaserF/hassio-addons/tree/master/switchcraft" \
org.opencontainers.image.documentation="https://github.com/FaserF/hassio-addons/blob/master/switchcraft/README.md" \
org.opencontainers.image.created="${BUILD_DATE}"