-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: fix and improve docker example
Before this commit the docker example was not properly building. The issue was introduced when moving from Theia 1.3x to 1.4x, where an extra step in the build process was introduced (i.e. running "yarn" was not enough, an extra "theia" command was needed). After this commit: - the docker example is building again - the docker image generated is stable and reproducible, not based on "next" - the docker image is much smaller thanks to a multistage build Signed-off-by: Francesco Robino <[email protected]>
- Loading branch information
1 parent
ff0943f
commit 3b6004e
Showing
5 changed files
with
44 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,38 @@ | ||
FROM node:16-alpine | ||
FROM node:16.20.2-bookworm-slim as build | ||
|
||
RUN mkdir /home/app | ||
WORKDIR /home/app | ||
|
||
RUN apk add --no-cache bash git python3 make pkgconfig libsecret-dev g++ | ||
# Use "bash" as replacement for "sh" | ||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | ||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
python3 \ | ||
make \ | ||
pkg-config \ | ||
libsecret-1-dev \ | ||
g++ \ | ||
libx11-dev \ | ||
libxkbfile-dev | ||
|
||
# Build the browser theia-trace-extension application | ||
COPY example-package.json /home/app/package.json | ||
RUN npx yarn | ||
COPY example-package.json /app/tte/package.json | ||
WORKDIR /app/tte/ | ||
RUN yarn && \ | ||
npx theia build --app-target=\"browser\" --mode development && \ | ||
yarn autoclean --init && \ | ||
echo *.ts >> .yarnclean && \ | ||
echo *.ts.map >> .yarnclean && \ | ||
echo *.spec.* >> .yarnclean && \ | ||
yarn cache clean | ||
|
||
FROM node:16.20.2-bookworm-slim | ||
|
||
COPY --from=build /app/tte /app/tte | ||
|
||
COPY startup.sh /home/app | ||
RUN ["chmod", "+x", "/home/app/startup.sh"] | ||
RUN apt-get update && apt-get install -y \ | ||
libx11-6 \ | ||
libxkbfile1 \ | ||
libsecret-1-0 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
ENV NODE_ENV production | ||
|
||
# Start the service | ||
ENTRYPOINT ["/home/app/startup.sh"] | ||
WORKDIR /app/tte | ||
COPY docker-entrypoint.sh /usr/local/bin | ||
EXPOSE 4000 | ||
ENTRYPOINT ["docker-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env bash | ||
yarn start --hostname 0.0.0.0 --port 4000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.