-
Notifications
You must be signed in to change notification settings - Fork 0
/
browser.Dockerfile
72 lines (57 loc) · 2.54 KB
/
browser.Dockerfile
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
# Builder stage
FROM node:18-bullseye AS build-stage
# install required tools to build the application
RUN apt-get update && apt-get install -y libxkbfile-dev libsecret-1-dev
WORKDIR /home/theia
# Copy repository files
COPY . .
# Remove unnecesarry files for the browser application
# Download plugins and build application production mode
# Use yarn autoclean to remove unnecessary files from package dependencies
RUN yarn --pure-lockfile && \
yarn build:extensions && \
yarn download:plugins && \
yarn browser build && \
yarn && \
yarn autoclean --init && \
echo *.ts >> .yarnclean && \
echo *.ts.map >> .yarnclean && \
echo *.spec.* >> .yarnclean && \
yarn autoclean --force && \
yarn cache clean && \
rm -rf .git applications/electron theia-extensions/launcher theia-extensions/updater node_modules
# Production stage uses a small base image
FROM node:18-bullseye-slim AS production-stage
# Create theia user and directories
# Application will be copied to /home/theia
# Default workspace is located at /home/project
RUN adduser --system --group theia
RUN chmod g+rw /home && \
mkdir -p /home/project && \
chown -R theia:theia /home/theia && \
chown -R theia:theia /home/project;
# Install required tools for application: Temurin JDK, JDK, SSH, Bash, Maven
# Node is already available in base image
RUN apt-get update && apt-get install -y wget apt-transport-https && \
wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /usr/share/keyrings/adoptium.asc && \
echo "deb [signed-by=/usr/share/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list && \
apt-get update && apt-get install -y git openssh-client openssh-server bash libsecret-1-0 temurin-17-jdk maven && \
apt-get purge -y wget && \
apt-get clean
ENV HOME /home/theia
WORKDIR /home/theia
# Copy application from builder-stage
COPY --from=build-stage --chown=theia:theia /home/theia /home/theia
EXPOSE 3000
# Specify default shell for Theia and the Built-In plugins directory
ENV SHELL=/bin/bash \
THEIA_DEFAULT_PLUGINS=local-dir:/home/theia/plugins
# Use installed git instead of dugite
ENV USE_LOCAL_GIT true
# Swtich to Theia user
USER theia
WORKDIR /home/theia/applications/browser
# Launch the backend application via node
ENTRYPOINT [ "node", "/home/theia/applications/browser/lib/backend/main.js" ]
# Arguments passed to the application
CMD [ "/home/project", "--hostname=0.0.0.0" ]