-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (30 loc) · 878 Bytes
/
Dockerfile
File metadata and controls
40 lines (30 loc) · 878 Bytes
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
FROM python:3.12.4-alpine3.19
LABEL maintainer="seyawudba"
ENV PYTHONUNBUFFERED=1
ARG DEV=false
ENV DEV=${DEV}
WORKDIR /src/
# Install system dependencies
RUN apk add --no-cache gcc musl-dev libpq
# Create user and group
RUN addgroup -g 1000 e-commerce && \
adduser \
--disabled-password \
--no-create-home \
--uid 1000 \
-G e-commerce \
product
# Copy project files and entrypoint script with correct ownership
COPY --chown=product:e-commerce . .
COPY --chown=product:e-commerce entrypoint.sh /entrypoint.sh
# Install Python dependencies
RUN pip install --upgrade pip && \
pip install psycopg2-binary && \
pip install -r requirements.txt && \
if [ "$DEV" = "true" ]; then \
pip install -r requirements-dev.txt; \
fi
EXPOSE 8000
USER product
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]