-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
27 lines (20 loc) · 868 Bytes
/
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
FROM alpine:latest
LABEL description="SWRAPH : a dockerized weatherdata to mqtt implementation"
LABEL maintainer="Stynoo"
ENV PROJECT=swraph
ENV PROJECT_DIR=/home/$PROJECT
WORKDIR $PROJECT_DIR
# Run `docker build --no-cache .` to update dependencies
RUN apk update --no-cache \
&& apk add --no-cache python3 su-exec \
&& python3 -m ensurepip \
&& rm -r /usr/lib/python*/ensurepip \
&& pip3 install --upgrade pip paho-mqtt \
&& if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi \
&& if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi \
&& rm -r /root/.cache
COPY swraph.py /home/swraph/swraph.py
RUN adduser -D -g '' $PROJECT \
&& chown -R $PROJECT:$PROJECT $PROJECT_DIR \
&& chmod a+x /home/swraph/swraph.py
CMD ["/sbin/su-exec", "swraph", "/usr/bin/python3", "/home/swraph/swraph.py"]