-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (47 loc) · 1.93 KB
/
Dockerfile
File metadata and controls
56 lines (47 loc) · 1.93 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
# Multi-stage build supporting both standalone and Home Assistant add-on
ARG BUILD_FROM=ghcr.io/hassio-addons/base-python:14.1.0
FROM ${BUILD_FROM}
# Set shell for add-on compatibility
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install Poetry
RUN pip3 install poetry
# Copy dependency files
WORKDIR /app
COPY pyproject.toml poetry.lock* ./
# Install Python dependencies
RUN \
apk add --no-cache --virtual .build-dependencies \
gcc \
musl-dev \
python3-dev \
&& poetry config virtualenvs.create false \
&& poetry install --only=main --no-dev \
&& apk del .build-dependencies
# Copy application source
COPY src/ /app/src/
# Copy Home Assistant add-on run script (if exists)
COPY .hacs/run.sh /run.sh 2>/dev/null || echo "#!/bin/bash\nexec python3 -m src.ocpp_proxy.main" > /run.sh
RUN chmod a+x /run.sh
# Expose WebSocket port
EXPOSE 9000
# Labels for Home Assistant add-on
LABEL \
io.hass.name="OCPP Proxy" \
io.hass.description="Multi-version OCPP proxy for secure EV charger sharing" \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="addon" \
io.hass.version="${BUILD_VERSION}" \
maintainer="OpenChargeHub" \
org.opencontainers.image.title="OCPP Proxy" \
org.opencontainers.image.description="Multi-version OCPP proxy for secure EV charger sharing" \
org.opencontainers.image.vendor="OpenChargeHub" \
org.opencontainers.image.authors="OpenChargeHub" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://github.com/openchargehub/ocpp-proxy" \
org.opencontainers.image.source="https://github.com/openchargehub/ocpp-proxy" \
org.opencontainers.image.documentation="https://github.com/openchargehub/ocpp-proxy" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.revision="${BUILD_REF}" \
org.opencontainers.image.version="${BUILD_VERSION}"
# Default command (can be overridden by run script)
CMD ["/run.sh"]