-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
40 lines (28 loc) · 1.01 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
# Compile image
FROM ubuntu:noble AS compile-image
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app
RUN apt-get update && \
apt-get install -y --no-install-recommends python3-pip python3-venv python3-dev pkg-config libhdf5-dev build-essential gcc && \
cd /usr/local/bin && \
ln -s /usr/bin/python3 python && \
python3 --version && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt requirements.txt
RUN python3 -m venv venv && \
venv/bin/pip install --no-cache-dir -r requirements.txt && \
pip list
RUN venv/bin/pip install pyinstaller
COPY uptonight uptonight
COPY targets targets
COPY main.py .
RUN venv/bin/pyinstaller --recursive-copy-metadata matplotlib --collect-all dateutil --onefile main.py
# Run image
FROM ubuntu:noble AS runtime-image
WORKDIR /app
# Copy only the necessary files from the build stage
COPY --from=compile-image /app/dist/main /app/main
COPY --from=compile-image /app/targets /app/targets
# Run the UpTonight executable
ENTRYPOINT ["/app/main"]