-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (31 loc) · 1.21 KB
/
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
FROM python:3.11-slim-buster
# Set Python Environment Variables
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
# Update packages
RUN apt-get update \
# Install dependencies for building Python packages
&& apt-get install -y build-essential \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
# Additional dependencies
&& apt-get install -y telnet netcat \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
# Requirements are installed here to ensure they will be cached.
COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt
# Copy 'start-fastapi.sh' shell script
COPY ./scripts/start-fastapi.sh /start-fastapi.sh
# Convert Windows line endings to Unix line endings via sed
RUN sed -i 's/\r$//g' /start-fastapi.sh
RUN chmod +x /start-fastapi.sh
# Copy 'start-celery-worker.sh' shell script
COPY ./scripts/start-celery-worker.sh /start-celery-worker.sh
# Remove all carriage returns from the file via sed
RUN sed -i 's/\r$//g' /start-celery-worker.sh
RUN chmod +x /start-celery-worker.sh
# Set working directory to the container directory
# with the app's copied source code
WORKDIR /app