-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathDockerfile-runner
62 lines (55 loc) · 1.79 KB
/
Dockerfile-runner
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
54
55
56
57
58
59
60
61
62
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
# Set environment variables to prevent interactive prompts during installation
ENV NVM_DIR=/root/.nvm \
NODE_VERSION=18.17.0 \
DEBIAN_FRONTEND=noninteractive \
NODE_OPTIONS="--max-old-space-size=8192" \
PYTHONUNBUFFERED=1 \
COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
PYTHONPATH="/usr/local/lib/python3.13/site-packages" \
IS_SANDBOX=True \
HATCH_BUILD_HOOKS_ENABLE=1
# Update packages lists and install git and curl
RUN apt-get update && apt-get install -y \
git \
curl \
gcc \
build-essential \
python3-dev \
# Cleanup apt cache to reduce image size
&& rm -rf /var/lib/apt/lists/*
# Install nvm and Node.js
SHELL ["/bin/bash", "-c"]
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \
&& source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm use default \
&& npm install -g yarn pnpm \
&& corepack enable \
&& corepack prepare yarn@stable --activate \
&& corepack prepare pnpm@latest --activate \
&& uv pip install --system uvicorn[standard]
# Add node and npm to PATH
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
RUN node --version \
&& corepack --version \
&& npm --version \
&& yarn --version \
&& pnpm --version \
&& python --version
# Build codegen
WORKDIR /codegen-sdk
COPY . .
RUN --mount=type=cache,target=/root/.cache/uv \
uv venv && source .venv/bin/activate \
&& uv sync --frozen --no-dev --all-extras \
&& uv pip install --system -e . --no-deps \
&& uv pip install --system .
RUN codegen --version
# Create a non-root user for local development + debugging
RUN useradd -m -s /bin/bash user
USER root
RUN chown -R user:user /home/user
USER user
WORKDIR /app
ENTRYPOINT ["/bin/bash", "-c"]