-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (37 loc) · 1012 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
ARG FROM_IMAGE=python:3.10-slim-bullseye
FROM $FROM_IMAGE
ARG UID=1000
ARG GID=1000
ENV PYTHONUNBUFFERED=1
ENV TZ=Europe/Latvia
# Update and install system deps
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
libpq-dev \
python3-dev \
gcc && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
pip install poetry==1.6.1
# Install app deps
COPY poetry.lock pyproject.toml /
RUN poetry config virtualenvs.create false && \
poetry install --only main && \
rm poetry.lock pyproject.toml
# Copy app
COPY src /opt/app
RUN chmod -R a=r-wx,u=rw,a+X /opt/app
# Add app user, grant app dir permissions
RUN addgroup app --gid $GID --system && \
adduser app --uid $UID --system --ingroup app && \
chown -R app:app /opt/app
# Add entrypoint
COPY docker-entrypoint.sh /
RUN chmod 755 /docker-entrypoint.sh
# Run app
USER app:app
WORKDIR /opt/app
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["run"]
#ENTRYPOINT ["/bin/bash"]