Skip to content

Instantly share code, notes, and snippets.

@unicomp21
Created June 28, 2023 12:12
Show Gist options
  • Save unicomp21/e8aba59e1b75a769c3d705b2ca7bb514 to your computer and use it in GitHub Desktop.
Save unicomp21/e8aba59e1b75a769c3d705b2ca7bb514 to your computer and use it in GitHub Desktop.
Dockerfile for filament webgl build
# Start from a Ubuntu image with the latest version of Ubuntu
FROM ubuntu:latest
# Update and upgrade Ubuntu packages
RUN apt-get update && apt-get upgrade -y
# Install necessary packages (libglu1-mesa-dev vs libgl-dev)
RUN apt-get install -y git python3 cmake build-essential clang llvm libc++-dev libc++abi-dev libgl-dev
# Set Clang as default C and C++ compiler
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
# Clone and build Emscripten
WORKDIR /
RUN git clone https://github.com/emscripten-core/emsdk.git
WORKDIR /emsdk
RUN ./emsdk install latest
RUN ./emsdk activate latest
# Set up Emscripten environment variables
ENV EMSDK=/emsdk
ENV EM_CONFIG=/emsdk/.emscripten
ENV EM_CACHE=/emsdk/cache
ENV EM_PORTS=/emsdk/ports
# Add emscripten to PATH
ENV PATH="/emsdk:${PATH}"
ENV PATH="/emsdk/upstream/emscripten:${PATH}"
ENV PATH="/emsdk/node/15.14.0_64bit/bin:${PATH}"
# Copy Filament into the Docker container
COPY ./filament /filament
# Build Filament
WORKDIR /filament
RUN ./build.sh -p webgl release
@unicomp21
Copy link
Author

git clone filament into subdirectory below Dockerfile
docker build -t filament .
docker run --rm -it filament bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment