-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.cloud-energy
36 lines (25 loc) · 1.13 KB
/
Dockerfile.cloud-energy
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
# Stage 1: Build the binary
FROM python:3.12.3-slim-bullseye as builder
# Install build tools
RUN apt-get update && apt-get install -y wget build-essential
# Set the working directory
WORKDIR /app
# Copy the source code
COPY demo-reporter/cpu-utilization.c demo-reporter/cpu-utilization.c
RUN gcc -o cpu-utilization demo-reporter/cpu-utilization.c
# we need to use debian image as many dependencies do not have compiled binaries in alpine and no GCC is installed
FROM python:3.12.3-slim-bullseye
RUN pip install --upgrade pip
RUN useradd -d /home/worker worker
WORKDIR /home/worker
RUN chown -R worker:worker /home/worker
USER worker
# Copy the compiled binary from the builder stage
COPY --from=builder --chown=worker:worker /app/cpu-utilization .
COPY --chown=worker:worker requirements-docker.txt requirements.txt
RUN --mount=type=cache,target=/home/worker/.cache/pip pip install --user -r requirements.txt
ENV PATH="/home/worker/.local/bin:${PATH}"
COPY --chown=worker:worker data/spec_data_cleaned.csv data/spec_data_cleaned.csv
COPY --chown=worker:worker auto_detect.py auto_detect.py
COPY --chown=worker:worker xgb.py xgb.py
CMD ["python"]