forked from balena-labs-research/python-wifi-connect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (35 loc) · 1001 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## Build Python packages to avoid need for builds in main image
FROM python:3.9.19-alpine3.20 AS python-buildstep
# Prevent pip 'warn script location' warnings. Equivalent to --no-warn-script-location
ENV PATH=/root/.local/bin:$PATH
RUN apk add --no-cache \
build-base \
dbus-dev \
dbus-libs \
git \
glib-dev
# Copy Python requirements file
COPY src/requirements.txt /tmp/
# Install packages into a directory
RUN pip install wheel --no-cache-dir
RUN pip install --user -r /tmp/requirements.txt --no-cache-dir
## Compile container
FROM python:3.9.19-alpine3.20
# Set system environment variables
ENV FLASK_APP=run
ENV FLASK_ENV=production
ENV PATH=/root/.local/bin:$PATH
# Set working directory
WORKDIR /app
# Install dependencies
RUN apk add --no-cache \
dbus-libs \
dnsmasq \
glib \
iw
# Copy built Python packages from build container
COPY --from=python-buildstep /root/.local /root/.local
# Insert application
COPY src .
# Run the start script
CMD ["sh", "start.sh"]