forked from r-near/nearc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
59 lines (45 loc) · 1.36 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
50
51
52
53
54
55
56
57
58
59
FROM --platform=$BUILDPLATFORM python:3.11-slim-bookworm AS base
# Install required packages and Homebrew dependencies
RUN apt-get update && apt-get install -y \
git \
make \
cmake \
clang \
gcc \
g++ \
wget \
curl \
xz-utils \
ca-certificates \
build-essential \
procps \
file \
&& rm -rf /var/lib/apt/lists/*
# Ensure Docker is detected
RUN touch /.dockerenv
# Install Homebrew
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
ENV PATH="/home/linuxbrew/.linuxbrew/bin:${PATH}"
# Install Emscripten using Homebrew
RUN brew install emscripten
# Install uv directly
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
# Set environment variables for Emscripten
ENV EMSDK="$(brew --prefix emscripten)/libexec"
ENV EMSCRIPTEN="$(brew --prefix emscripten)/libexec/upstream/emscripten"
ENV PATH="${EMSCRIPTEN}:${PATH}"
# Mark as running in a container
ENV CONTAINER="1"
# Verify Emscripten installation
RUN emcc -v
ENV PATH="/root/.local/bin:$PATH"
# Set up working directory
WORKDIR /app
# Copy your project files to the container
COPY src/ pyproject.toml uv.lock README.md /app/
# Install nearc
RUN uv tool install .
# Set working directory for build outputs
WORKDIR /home/near/code
# Set entrypoint to nearc with automatic dependency setup
ENTRYPOINT ["nearc", "--create-venv"]