Skip to content

Commit 94cc38f

Browse files
committed
hardening docker images
1 parent 76630ea commit 94cc38f

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

.dockerignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ __pycache__/
44
config/*.txt
55
logs/*.log
66

7+
tests/
8+
config.ini.example
9+
710
.github
811
.bumpversion.cfg
912
.gitignore
1013
.git
1114
.pylintrc
1215
.readthedocs.yaml
13-
CHANGELOFG.md
16+
CHANGELOG.md

Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
FROM python:3.13-slim
2-
1+
FROM python:3.13-slim as builder
32
WORKDIR /app
4-
53
COPY requirements.txt .
6-
RUN pip install --no-cache-dir -r requirements.txt
4+
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
75

8-
COPY . .
96

7+
FROM python:3.13-slim
8+
RUN useradd -m -s /bin/bash pyproxy
9+
WORKDIR /app
10+
COPY --from=builder /install /usr/local
11+
COPY . .
12+
RUN chown -R pyproxy:pyproxy /app
13+
USER pyproxy
1014
EXPOSE 8080
11-
1215
ENTRYPOINT ["python3", "pyproxy.py"]

0 commit comments

Comments
 (0)