-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (37 loc) · 1.25 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
FROM alpine:3.21.0 AS builder
COPY . /app
RUN COLOUR='\e[1;93m' && \
echo -e "${COLOUR}Installing build dependencies...\e[0m" && \
apk --no-cache add --virtual=build-dependencies \
openssh-client-common \
openssh-client-default \
git \
py3-pip && \
echo -e "${COLOUR}Done.\e[0m"
# Define the python virtual environment
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv --upgrade-deps $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN COLOUR='\e[1;93m' && \
echo -e "${COLOUR}Installing Labnode PID daemon...\e[0m" && \
pip install ./app && \
echo -e "${COLOUR}Done.\e[0m"
FROM alpine:3.21.0
LABEL maintainer="Patrick Baus <[email protected]>"
LABEL description="Labnode PID controller daemon"
ARG WORKER_USER_ID=5555
ARG SENSOR_IP=localhost
# Upgrade installed packages,
# add a user called `worker`
# Then install Python dependency
RUN apk --no-cache upgrade && \
addgroup -g ${WORKER_USER_ID} worker && \
adduser -D -u ${WORKER_USER_ID} -G worker worker && \
apk --no-cache add python3
COPY --from=builder /opt/venv /opt/venv
# Enable venv
ENV PATH="/opt/venv/bin:$PATH"
COPY --from=builder /app /app
RUN chown -R worker:worker /app
USER worker
CMD ["python3", "-OO", "-u", "/app/temperature_controller.py"]