summaryrefslogtreecommitdiff
path: root/Dockerfile
blob: b14aa153b8cc37923ddda59e185a67d8a32f346c (plain)
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
FROM debian:trixie

# enable more components and update repos
RUN apt update -y

# install libraries
RUN apt install -y \
	 libasound2-dev \
	 libpulse-dev \
	 libwayland-dev \
	 libxrandr-dev \
	 libxinerama-dev \
	 libxcursor-dev \
	 libxi-dev \
	 libxkbcommon-dev \
	 libsdl2-dev \
	 libclang-dev

# Install build tools
RUN apt install -y \
	rustup \
	gcc \
	g++ \
	cmake \
	git \
	xz-utils

# Install emscripten
RUN git clone https://github.com/emscripten-core/emsdk.git /emsdk
RUN /emsdk/emsdk install latest
RUN /emsdk/emsdk activate latest

# add build user
RUN useradd -u 1000 -m builder -d /home/builder
USER builder

# Install rust and toolchain
RUN rustup default stable
RUN rustup target add wasm32-unknown-emscripten

# set emscripten env
ENV RUSTFLAGS="-C panic=unwind"
ENV EMCC_CFLAGS="-O3 -sUSE_GLFW=3 -sASSERTIONS=1 -sWASM=1 -sASYNCIFY -sGL_ENABLE_GET_PROC_ADDRESS=1 -sEXPORTED_RUNTIME_METHODS=HEAPF32,ccall,cwrap"
ENV EMSDK=/emsdk
ENV EMSDK_NODE=/emsdk/node/22.16.0_64bit/bin/node
ENV PATH="${EMSDK}/upstream/bin:${EMSDK}/upstream/emscripten:${EMSDK_NODE}:${PATH}"

# build the code
VOLUME /data
WORKDIR /data
CMD ["cargo", "build", "--target", "wasm32-unknown-emscripten", "--release"]