Skip to content

Instantly share code, notes, and snippets.

@mr-ema
Last active March 22, 2024 05:49
Show Gist options
  • Save mr-ema/d78ec7fefb8ea1ed8b2907eb2f0dc9da to your computer and use it in GitHub Desktop.
Save mr-ema/d78ec7fefb8ea1ed8b2907eb2f0dc9da to your computer and use it in GitHub Desktop.
[Docker] Raylib with Zig
FROM ubuntu:latest
# I use this image for building [zig + raylib] projects.
#
# You can use it like this:
# -> docker run --rm -v "$(pwd)":/home -it <image-name>
# ------------------------- OR -------------------------
# -> docker run -v "$(pwd)":/home <image-name> zig build
#
# This command will open the Docker container, and the current folder will be shared.
# This allows you to build your project in Docker and edit it outside in your preferred editor.
RUN apt-get update && apt-get install -y \
build-essential git libasound2-dev \
libx11-dev libxrandr-dev libxi-dev \
libgl1-mesa-dev libglu1-mesa-dev \
libxcursor-dev libxinerama-dev wget \
tar cmake neovim
# Install Zig
RUN wget https://ziglang.org/builds/zig-linux-x86_64-0.11.0.tar.xz -O /tmp/zig.tar.xz
RUN mkdir -p /usr/share/zig-linux
RUN tar -xvf /tmp/zig.tar.xz --strip-components=1 -C /usr/share/zig-linux
RUN ln -s /usr/share/zig-linux/zig /usr/bin/zig
# Script to install emscripten to compile to wasm
RUN echo "git clone https://github.com/emscripten-core/emsdk.git && \
cd emsdk && git pull && ./emsdk install latest && \
./emsdk activate latest && source ./emsdk_env.sh" > /home/install_emscripten.sh
WORKDIR /home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment