-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (36 loc) · 1.07 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (36 loc) · 1.07 KB
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
FROM python:3.12.8-slim-bookworm AS build
WORKDIR /opt/CodeGuard
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libffi-dev \
libssl-dev \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
COPY . /opt/CodeGuard
RUN pip install --no-cache-dir -r requirements.txt
FROM python:3.12.8-slim-bookworm AS release
WORKDIR /opt/CodeGuard
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libffi8 \
libssl3 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --chown=1001:1001 . /opt/CodeGuard
RUN useradd \
--no-log-init \
--shell /bin/bash \
-u 1001 \
codeguard \
&& mkdir -p /opt/CodeGuard/instance \
&& chown -R 1001:1001 /opt/CodeGuard/instance /opt/CodeGuard \
&& chmod +x /opt/CodeGuard/entrypoint.sh
COPY --chown=1001:1001 --from=build /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
USER 1001
EXPOSE 5000
ENTRYPOINT ["/opt/CodeGuard/entrypoint.sh"]