blumeops/containers/teslamate/Dockerfile
Erich Blume 613f05dfde
All checks were successful
Build Container (Nix) / detect (push) Successful in 2s
Build Container / detect (push) Successful in 2s
Build Container (Nix) / build (alloy) (push) Successful in 9s
Build Container (Nix) / build (cv) (push) Successful in 2s
Build Container (Nix) / build (devpi) (push) Successful in 2s
Build Container (Nix) / build (grafana) (push) Successful in 2s
Build Container / build (cv) (push) Successful in 20s
Build Container (Nix) / build (grafana-sidecar) (push) Successful in 2s
Build Container (Nix) / build (homepage) (push) Successful in 2s
Build Container (Nix) / build (kiwix-serve) (push) Successful in 2s
Build Container (Nix) / build (kubectl) (push) Successful in 3s
Build Container (Nix) / build (loki) (push) Successful in 2s
Build Container / build (alloy) (push) Successful in 40s
Build Container (Nix) / build (mealie) (push) Successful in 1s
Build Container (Nix) / build (miniflux) (push) Successful in 2s
Build Container (Nix) / build (navidrome) (push) Successful in 2s
Build Container / build (devpi) (push) Successful in 41s
Build Container (Nix) / build (nettest) (push) Successful in 15s
Build Container / build (grafana-sidecar) (push) Successful in 1m27s
Build Container / build (grafana) (push) Successful in 3m23s
Build Container (Nix) / build (ntfy) (push) Successful in 3m19s
Build Container (Nix) / build (prometheus) (push) Successful in 1s
Build Container (Nix) / build (quartz) (push) Successful in 1s
Build Container (Nix) / build (runner-job-image) (push) Successful in 1s
Build Container (Nix) / build (teslamate) (push) Successful in 2s
Build Container (Nix) / build (transmission) (push) Successful in 2s
Build Container (Nix) / build (transmission-exporter) (push) Successful in 1s
Build Container (Nix) / build (unpoller) (push) Successful in 1s
Build Container / build (kiwix-serve) (push) Successful in 1m17s
Build Container / build (kubectl) (push) Successful in 41s
Build Container / build (homepage) (push) Successful in 8m21s
Build Container / build (mealie) (push) Successful in 1m1s
Build Container / build (loki) (push) Successful in 8m21s
Build Container / build (miniflux) (push) Successful in 2m24s
Build Container / build (nettest) (push) Successful in 14s
Build Container / build (ntfy) (push) Successful in 8m33s
Build Container / build (prometheus) (push) Successful in 37s
Build Container / build (quartz) (push) Successful in 19s
Build Container / build (navidrome) (push) Successful in 10m36s
Build Container / build (runner-job-image) (push) Successful in 3m18s
Build Container / build (transmission) (push) Successful in 20s
Build Container / build (transmission-exporter) (push) Successful in 21s
Build Container / build (unpoller) (push) Successful in 11s
Build Container / build (teslamate) (push) Successful in 4m42s
Add consistent OCI labels to all container Dockerfiles
Every container now carries title, description, version, source, and
vendor labels per the OCI image spec. Version is derived from the
existing CONTAINER_APP_VERSION ARG at build time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 20:42:00 -07:00

84 lines
2.4 KiB
Docker

# TeslaMate - Tesla data logger
# Based on upstream Dockerfile
ARG CONTAINER_APP_VERSION=v3.0.0
ARG TESLAMATE_VERSION=${CONTAINER_APP_VERSION}
FROM elixir:1.19.5-otp-26 AS builder
ARG TESLAMATE_VERSION
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install -y ca-certificates curl gnupg git zstd brotli \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& NODE_MAJOR=22 \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" \
| tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install nodejs -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN mix local.rebar --force && \
mix local.hex --force
# Clone specific version
RUN git clone --depth 1 --branch ${TESLAMATE_VERSION} \
https://forge.ops.eblu.me/mirrors/teslamate.git /opt/app
ENV MIX_ENV=prod
WORKDIR /opt/app
RUN mix deps.get --only $MIX_ENV
RUN mix deps.compile
RUN npm ci --prefix ./assets --progress=false --no-audit --loglevel=error
RUN mix assets.deploy
RUN mix compile
RUN SKIP_LOCALE_DOWNLOAD=true mix release --path /opt/built
# Runtime image
FROM debian:trixie-slim AS app
ARG CONTAINER_APP_VERSION
LABEL org.opencontainers.image.title="TeslaMate"
LABEL org.opencontainers.image.description="Tesla data logger and visualization"
LABEL org.opencontainers.image.version="${CONTAINER_APP_VERSION}"
LABEL org.opencontainers.image.source="https://forge.eblu.me/eblume/blumeops"
LABEL org.opencontainers.image.vendor="blumeops"
ENV LANG=C.UTF-8 \
SRTM_CACHE=/opt/app/.srtm_cache \
HOME=/opt/app
WORKDIR $HOME
RUN apt-get update && apt-get install -y --no-install-recommends \
libodbc2 \
libsctp1 \
libssl3t64 \
libstdc++6 \
netcat-openbsd \
tini \
tzdata \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --gid 10001 --system nonroot \
&& useradd --uid 10000 --system --gid nonroot --home-dir /home/nonroot --shell /sbin/nologin nonroot \
&& chown -R nonroot:nonroot .
COPY --chown=nonroot:nonroot --chmod=555 entrypoint.sh /
COPY --from=builder --chown=nonroot:nonroot /opt/built .
RUN mkdir $SRTM_CACHE
USER nonroot:nonroot
EXPOSE 4000
ENTRYPOINT ["tini", "--", "/bin/dash", "/entrypoint.sh"]
CMD ["bin/teslamate", "start"]