-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
48 lines (34 loc) · 910 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
48
FROM python:3.13-slim-bookworm AS base
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Cache config env vars
ENV CACHE_CAPACITY_MB=16
ENV CACHE_LINE_SIZE_B=64
ENV CACHE_ASSOCIATIVITY=16
ENV CACHE_PROTOCOL=MESI
ENV ADDRESS_SIZE=32
# Security updates, run as root:
RUN apt-get update && apt-get -y upgrade
COPY requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# Switch to non-root user:
RUN useradd --create-home llcsim
WORKDIR /home/llcsim
USER llcsim
COPY ./src ./app
#
# Create test image
#
FROM base AS test
COPY ./tests ./tests
# Set the PYTHONPATH environment variable for unittest
ENV PYTHONPATH=/home/llcsim/app
# Run the tests
CMD ["python", "-m", "unittest"]
#
# Create production image
#
FROM base AS production
CMD [ "python", "main.py" ]