-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.base
More file actions
53 lines (38 loc) · 1.4 KB
/
Dockerfile.base
File metadata and controls
53 lines (38 loc) · 1.4 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
48
49
50
51
52
53
# Base Image
FROM python:3.8-slim-buster
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV APP_HOME=/app
WORKDIR $APP_HOME
# Copy the requirements file into the container
COPY requirements-base.txt $APP_HOME/
# Copy the shared code into the container
COPY ./src/shared $APP_HOME/shared
# Copy the scripts i.e wait-for-it.sh
COPY ./src/scripts $APP_HOME/scripts
# Copy the database models
COPY ./database_models $APP_HOME/database_models
# Install system-level dependencies (adjusted for Debian)
# libpq-dev is for psycopg2 (PostgreSQL)
RUN apt-get update && apt-get install -y \
build-essential \
python3-dev \
libpq-dev && rm -rf /var/lib/apt/lists/* # Clean up
# Install entr
RUN apt-get update && apt-get install -y entr
# Install librdkafka development package (adjusted for Debian)
RUN apt-get update && apt-get install -y librdkafka-dev
# Install common Python libraries
RUN pip install -r requirements-base.txt --no-cache-dir
# (Optional) Create a group and user to run the application
# Create a group 'appgroup'
RUN addgroup --system appgroup
# Create a user 'appuser' and add to 'appgroup'
RUN adduser --system --ingroup appgroup appuser
# Set the user to the newly created user
USER appuser
# (Optional) Expose any common ports needed by your services
# EXPOSE 8000
# (Optional) Default command to keep the container running
# CMD ["tail", "-f", "/dev/null"]