-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
35 lines (25 loc) · 1.11 KB
/
Dockerfile
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
ARG BUILD_FROM
# --- BACKEND BUILD
# About golang version: downgrade Go to 1.22.x to avoid https://github.com/golang/go/issues/68976
# About base image: we need to use a musl-based docker image since the actual HomeAssistant addon
# base image will be musl-based as well. This is required since we depend from "github.com/mattn/go-sqlite3"
# which is a CGO library; so that's why we select the -alpine variant
FROM golang:1.22-alpine AS builder-go
WORKDIR /app/backend
COPY dhcp-clients-webapp-backend .
RUN --mount=type=cache,target=/root/.cache/apk \
apk add build-base
RUN --mount=type=cache,target=/root/.cache/go \
CGO_ENABLED=1 go build -o /dhcp-clients-webapp-backend .
# --- Actual ADDON layer
FROM $BUILD_FROM
# Add env
ENV LANG=C.UTF-8
# Setup base
RUN apk add --no-cache dnsmasq nginx-debug sqlite socat && mv /etc/nginx /etc/nginx-orig
# Copy data
COPY rootfs /
COPY dhcp-clients-webapp-backend/templates/ /opt/web/templates/
# Copy backend and frontend
COPY --from=builder-go /dhcp-clients-webapp-backend /opt/bin/
LABEL org.opencontainers.image.source=https://github.com/f18m/ha-addon-dnsmasq-dhcp-server