-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
47 lines (36 loc) · 1.18 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
ARG PYTHON_VERSION=3.12
# https://hub.docker.com/_/python
FROM python:"${PYTHON_VERSION}-slim"
ARG CODE_LOCATION
# set container envs
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PATH="/app/.venv/bin:${PATH}"
ENV UV_LINK_MODE=copy
ENV UV_COMPILE_BYTECODE=1
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
openssh-client=1:9.2p1-2+deb12u3 sshpass=1.09-1* \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# set workdir
WORKDIR /app
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/
COPY uv.lock pyproject.toml /app/
# Install dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --no-install-project --no-editable
# Copy the project into the image
COPY src/ /app/src/
# Sync the project
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --no-editable
# Install dbt project
RUN dagster-dbt project prepare-and-package \
--file "src/teamster/code_locations/${CODE_LOCATION}/__init__.py"
# Create a custom user with UID 1234 and GID 1234
RUN groupadd -g 1234 teamster \
&& useradd -m -u 1234 -g teamster teamster \
&& chown -R 1234:1234 /app
# Switch to the custom user
USER 1234:1234