Skip to content

Commit

Permalink
[Docker example] Streamline trace viewer app/image
Browse files Browse the repository at this point in the history
A few small changes that make the example docker image smaller and build a bit faster:

- Build the theia trace viewer app/appliance in "production" mode (vs development)
- Have yarn remove the installed "devDependencies" after the build ("yarn --production")
  - adapt docker-entrypoint.sh to start the app directly rather than through @theia/cli
- Remove redundant "theia build" triggered in "prepare" package.json scripts entry - it's
  also done in Dockerfile

Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
  • Loading branch information
marcdumais-work committed Mar 25, 2024
1 parent 510e3bc commit 26edf9d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion examples/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ RUN apt-get update && apt-get install -y \
COPY example-package.json /app/tte/package.json
WORKDIR /app/tte/
RUN yarn && \
npx theia build --app-target=\"browser\" --mode development && \
npx theia build --app-target=\"browser\" --mode production && \
yarn autoclean --init && \
echo *.ts >> .yarnclean && \
echo *.ts.map >> .yarnclean && \
echo *.spec.* >> .yarnclean && \
yarn --production && \
yarn cache clean && \
du -hs /app/tte

Expand Down
3 changes: 2 additions & 1 deletion examples/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env bash
yarn start --hostname 0.0.0.0 --port 4000
# @theia/cli not installed, so start the app directly
node ./src-gen/backend/main.js --hostname 0.0.0.0 --port 4000
1 change: 0 additions & 1 deletion examples/docker/example-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"@theia/cli": "1.45.1"
},
"scripts": {
"prepare": "theia build",
"start": "theia start",
"watch": "theia build --watch"
},
Expand Down

0 comments on commit 26edf9d

Please sign in to comment.