-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (31 loc) · 908 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
# Pull official base image
FROM python:3.11.2
LABEL maintainer="Gentian Demaj <[email protected]>"
# Update system dependencies
RUN apt-get update
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
VIRTUAL_ENV=/opt/venv
# Add python to PATH
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"
# Create python virtual environment
RUN python -m venv ${VIRTUAL_ENV}
# Set work directory
WORKDIR /code
# Copy project and requirements
COPY requirements.txt requirements.txt
COPY shop_api shop_api
COPY tests tests
COPY scripts scripts
COPY alembic alembic
COPY alembic.ini alembic.ini
# Install dependencies
RUN python -m pip install --no-cache-dir --upgrade pip && \
python -m pip install -r requirements.txt && \
adduser --disabled-password --no-create-home app && \
chown -R app:app /opt/venv
# Use newly created user
USER app
# Sanity check
RUN python --version