FROM node:18-slim # 1. Install git, certificates AND wget RUN apt-get update \ && apt-get install -y --no-install-recommends \ git \ ca-certificates \ wget \ && rm -rf /var/lib/apt/lists/* WORKDIR /app ARG BRANCH=experimental4 ARG SUBFOLDER=smollm-webgpu # 2. Clone only the subfolder you need RUN git clone --depth 1 --branch ${BRANCH} \ https://github.com/YoussefElshaarawy/transformers.js-examples.git tempdir \ && mv tempdir/${SUBFOLDER}/* . \ && rm -rf tempdir # 3. Build your app RUN npm install RUN npm run build # 4. Static server & OpenVSCode server RUN npm install -g serve # Download and unpack OpenVSCode server ADD https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v1.86.2/openvscode-server-v1.86.2-linux-x64.tar.gz /tmp/openvscode-server.tar.gz RUN tar -xzf /tmp/openvscode-server.tar.gz -C /opt \ && rm /tmp/openvscode-server.tar.gz \ && mv /opt/openvscode-server-v1.86.2-linux-x64 /opt/openvscode-server \ && chown -R 1000:1000 /opt/openvscode-server ENV PORT=7860 EXPOSE 7860 CMD ["sh", "-c", "serve -s dist -l tcp://0.0.0.0:${PORT:-7860}"]