refactor: restructure codebase for v1 kasm docker release
This commit is contained in:
+45
-27
@@ -1,37 +1,55 @@
|
||||
# Use the official Node.js 20 image as the base image
|
||||
FROM node:20
|
||||
RUN chmod 1777 /tmp
|
||||
# Install necessary dependencies for running Chrome
|
||||
RUN apt-get update && apt-get install -y \
|
||||
wget \
|
||||
gnupg \
|
||||
ca-certificates \
|
||||
apt-transport-https \
|
||||
xvfb \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
FROM kasmweb/chrome:1.19.0
|
||||
|
||||
# Install Google Chrome
|
||||
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
||||
&& echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y google-chrome-stable \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
USER root
|
||||
|
||||
# Set up the working directory in the container
|
||||
# Install Node.js 20.x
|
||||
RUN rm -f /etc/apt/sources.list.d/google-chrome.list && \
|
||||
apt-get update && \
|
||||
apt-get install -y curl && \
|
||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
||||
apt-get install -y nodejs && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create app directory and set ownership to kasm-user
|
||||
RUN mkdir -p /app && chown -R 1000:1000 /app
|
||||
|
||||
# Switch to kasm-user to run npm install safely
|
||||
USER 1000
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json to the working directory
|
||||
COPY package*.json ./
|
||||
# Copy application files (ignoring node_modules and browser_profiles)
|
||||
COPY --chown=1000:1000 . /app
|
||||
|
||||
# Install Node.js dependencies
|
||||
# Pre-create the browser_profiles and data directory so the volume inherits the correct ownership
|
||||
RUN mkdir -p /app/browser_profiles /app/data && chown -R 1000:1000 /app/browser_profiles /app/data
|
||||
|
||||
# Install Node dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the application code
|
||||
COPY . .
|
||||
# Create a custom entrypoint script
|
||||
USER root
|
||||
RUN echo '#!/bin/bash\n\
|
||||
# Start Kasm VNC server in the background\n\
|
||||
/dockerstartup/vnc_startup.sh &\n\
|
||||
\n\
|
||||
# Wait for the X server to fully initialize\n\
|
||||
sleep 5\n\
|
||||
\n\
|
||||
# Set environment variables for YOUChat_Proxy\n\
|
||||
export USE_MANUAL_LOGIN="true"\n\
|
||||
export HIDE_BROWSER="false"\n\
|
||||
export BROWSER_PATH="/usr/bin/google-chrome"\n\
|
||||
export DISPLAY=:1\n\
|
||||
\n\
|
||||
# Start the proxy server\n\
|
||||
cd /app\n\
|
||||
node src/index.mjs\n\
|
||||
' > /app/start-proxy.sh && chmod +x /app/start-proxy.sh
|
||||
|
||||
# Expose the port your app runs on
|
||||
EXPOSE 8080
|
||||
USER 1000
|
||||
|
||||
# Command to run the application
|
||||
# Expose Kasm VNC port and Proxy API port
|
||||
EXPOSE 6901 8080
|
||||
|
||||
CMD [ "node", "index.mjs" ]
|
||||
ENTRYPOINT ["/app/start-proxy.sh"]
|
||||
Reference in New Issue
Block a user