-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathDockerfile
65 lines (47 loc) · 1.63 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
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
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION=3.13.0
ARG WEEWX_UID=1000
ARG WEEWX_HOME="/home/weewx"
FROM python:${PYTHON_VERSION} AS build-stage
RUN apt-get update && apt-get install -y clang lld
WORKDIR /tmp
RUN \
--mount=type=cache,mode=0777,target=/var/cache/apt \
--mount=type=cache,mode=0777,target=/root/.cache/pip <<EOF
apt-get update
python -m pip install --upgrade pip
pip install --upgrade virtualenv
virtualenv /opt/venv
EOF
COPY pyproject.toml README.md requirements.txt ./
COPY src/_version.py ./src/_version.py
# Python setup
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache --requirement requirements.txt
WORKDIR /root
COPY src/entrypoint.sh src/_version.py ./
FROM python:${PYTHON_VERSION}-slim AS final-stage
ARG TARGETPLATFORM
ARG WEEWX_HOME
ARG WEEWX_UID
# For a list of pre-defined annotation keys and value types see:
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
#
# Note: Additional labels are added by the build workflow.
LABEL org.opencontainers.image.authors="[email protected]"
LABEL org.opencontainers.image.vendor="Geekpad"
RUN addgroup --system --gid ${WEEWX_UID} weewx \
&& adduser --system --uid ${WEEWX_UID} --ingroup weewx weewx
RUN apt-get update && apt-get install -y git libusb-1.0-0
WORKDIR ${WEEWX_HOME}
COPY --from=build-stage /opt/venv /opt/venv
COPY --from=build-stage /root ${WEEWX_HOME}
RUN mkdir /data \
&& chown -R weewx:weewx /data
VOLUME ["/data"]
ENV PATH="/opt/venv/bin:$PATH"
ENV PIP_TARGET="/data/lib/python/site-packages"
ENV PYTHONPATH="/data/lib/python/site-packages"
USER weewx
ENTRYPOINT ["./entrypoint.sh"]