File size: 1,128 Bytes
b087e89
 
 
 
 
 
 
 
 
 
 
d3a9d99
b087e89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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}"]