-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (37 loc) · 1.3 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
42
43
44
45
46
47
48
49
FROM python:3.11-slim
# Update and install system dependencies
RUN apt-get update && \
apt-get install --no-install-recommends --yes \
gcc libpq-dev python3-dev git curl iputils-ping && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create a non-root user
ARG USER_ID=1000
ARG GROUP_ID=1000
RUN addgroup --gid $GROUP_ID appgroup && \
adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID appuser
# Setup the working directory
WORKDIR /app
RUN chown -R appuser:appgroup /app && chmod -R 755 /app
# Switch to non-root user
USER appuser
# Copy the Python requirements and install them
COPY requirements.txt /app/requirements.txt
RUN pip install --user -r /app/requirements.txt
# Copy dbt project
COPY dbt_project.yml /app/dbt_project.yml
# Copy profiles.yml to the .dbt directory in the user's home
COPY profiles.yml /home/appuser/.dbt/profiles.yml
# Copy macros, models and seeds
COPY /macros /app/macros
COPY /models /app/models
COPY /seeds /app/seeds
COPY cron.sh /app/cron.sh
COPY cron_preview.sh /app/cron_preview.sh
COPY forever.sh /app/forever.sh
# Set environment variable to specify the DBT project path
ENV DBT_PROJECT_PATH /app/src
# Optionally expose a port for dbt docs if needed
EXPOSE 8080
# Set PATH to include user-level binaries
ENV PATH=/home/appuser/.local/bin:$PATH