Skip to content

Commit

Permalink
Add multi stage Dockerfile to build Trace Compass
Browse files Browse the repository at this point in the history
1. The stage "packager" installs the minimum package needed to
compile tracecompass.
2. Then it will copy the project inside the container then run
the command to build tracecompass.
3. After the build, it will go to the next stage and this stage will
just have the bare minimum configuration to run tracecompass.
4. It will copy tracecompass already installed into the new stage.

[Added] Multi stage Dockerfile to build Trace Compass

This change can be exercised through the companion Incubator change [1].

[1]https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/199977

Change-Id: I371d50331fcd5989a3f672044a05b9f1914974f7
Signed-off-by: Ahmad Faour <ahmad.faour@polymtl.ca>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/199945
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Marco Miller <marco.miller@ericsson.com>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Marco Miller <marco.miller@ericsson.com>
  • Loading branch information
Spiritus2424 authored and marco-miller committed Apr 28, 2023
1 parent a2bd70b commit 28c8aea
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Compiled output
**/target/
workspace/
**/bin/
*/.settings/org.sonar.ide.eclipse.core.prefs
.polyglot.build.properties
.tycho-consumer-pom.xml

# Git
.git*
!.git/

# Markdown files
*.md

# IDEs and editors
.vscode/*
.history/*
.devcontainer/

# Dockerfiles
Dockerfile*

# System files
.DS_Store
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
bin/
target/
workspace/

# VS Code
.devcontainer
.vscode
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,12 @@ the build system. You can set them by using `-P[profile name]` and
the destination specified by `-DdocDestination=/absolute/path/to/destination`.
Some directories may need to already exist at the destination (or Maven will
throw related errors).

Build Trace Compass image with Docker
-------------------------------------

To compile the image of Trace Compass with Docker, run the following command from the top level directory:

docker build -f releng/dockerfiles/Dockerfile -t tracecompass .

The image will be tagged `tracecompass`.
22 changes: 22 additions & 0 deletions releng/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2023 Polytechnique de Montréal
#
# All rights reserved. This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0 which
# accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0

FROM alpine:3.16.0 as packager

RUN apk --no-cache add openjdk17-jdk openjdk17-jmods maven

COPY ./ /app/

WORKDIR /app/

RUN mvn clean install -DskipTests -Dskip-rcp -Pfilter-grammar -Pctf-grammar

FROM alpine:3.16.0

COPY --from=packager /root/.m2/repository/org/eclipse/tracecompass /root/.m2/repository/org/eclipse/tracecompass

0 comments on commit 28c8aea

Please sign in to comment.