-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
82 lines (67 loc) · 2.21 KB
/
Dockerfile
File metadata and controls
82 lines (67 loc) · 2.21 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Stage 1: Builder stage
FROM node:20-bullseye as build-stage
# Install build dependencies
RUN apt-get update && apt-get install -y libxkbfile-dev libsecret-1-dev
# Set the working directory
WORKDIR /home/zein-ide
# Copy the current directory contents to the container
COPY . .
# Remove .git if present
RUN rm -rf /home/zein-ide/.git
# Run the build commands following the exact sequence from package.json
RUN yarn --frozen-lockfile && \
yarn prepare && \
yarn postinstall && \
yarn download:plugins && \
yarn build:browser
# Stage 2: Production stage, using a slim image
FROM node:20-bullseye-slim as production-stage
# Install language support dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
# C/C++ dependencies
build-essential \
gdb \
clangd \
# Python dependencies
python3 \
python3-pip \
python3-venv \
# Java dependencies
default-jdk \
# Common dependencies
git \
curl \
procps \
lsof \
&& apt-get clean \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& rm -rf /var/lib/apt/lists/*
# Install Python language server
RUN pip3 install --no-cache-dir python-lsp-server && \
pip3 install \
mccabe \
pyflakes \
rope \
yapf \
autopep8 \
pylint && \
pip3 uninstall -y pycodestyle
# Create a non-root user with a fixed user id and setup the environment
RUN adduser --system --group --uid 200 zein && \
chmod g+rw /home && \
mkdir -p /home/zein-ide && \
mkdir -p /home/zein-ide/workspace && \
chown -R zein:zein /home/zein-ide
# Set environment variables for the application
ENV HOME=/home/zein
WORKDIR /home/zein-ide
# Copy the build output to the production environment
COPY --from=build-stage --chown=zein:zein /home/zein-ide /home/zein-ide
# Expose the default Theia port
EXPOSE 3000
# Use the non-root user
USER zein
# Set the working directory to the browser application
WORKDIR /home/zein-ide/browser-app
# Start the application with plugins loaded from the plugins directory and workspace
ENTRYPOINT ["node", "/home/zein-ide/browser-app/lib/backend/main.js", "/home/zein-ide/workspace", "--hostname=0.0.0.0", "--plugins=local-dir:/home/zein-ide/plugins"]