Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added build instructions and alternative multi-stage Dockerfile. #2

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
#
# SPDX-License-Identifier: Apache-2.0

FROM azul/zulu-openjdk-alpine:17
FROM eclipse-temurin:17-jre-alpine

RUN apk add --update \
curl \
&& rm -rf /var/cache/apk/*
RUN apk add --update \
curl \
&& rm -rf /var/cache/apk/*

RUN addgroup --gid 1000 jumper && adduser --uid 1000 -G jumper -D jumper --no-create-home
RUN addgroup -g 1000 -S app
RUN adduser -u 1000 -D -H -S -G app app

USER 1000:1000

EXPOSE 8080 8082

COPY target/*.jar /usr/share/jumper.jar
COPY target/*.jar /usr/share/app.jar

WORKDIR /usr/share/

CMD java $JVM_OPTS -jar /usr/share/jumper.jar

CMD java $JVM_OPTS -jar /usr/share/app.jar
30 changes: 30 additions & 0 deletions Dockerfile.multi-stage
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2023 Deutsche Telekom AG
#
# SPDX-License-Identifier: Apache-2.0

FROM maven:3.9-eclipse-temurin-17-alpine AS build
RUN mkdir -p /usr/app
WORKDIR /usr/app
ADD . /usr/app

RUN mvn -f /usr/app/pom.xml clean package


FROM eclipse-temurin:17-jre-alpine

RUN apk add --update \
curl \
&& rm -rf /var/cache/apk/*

RUN addgroup -g 1000 -S app
RUN adduser -u 1000 -D -H -S -G app app

USER 1000:1000

EXPOSE 8080 8082

COPY --from=build /usr/app/target/*.jar /usr/share/app.jar

WORKDIR /usr/share/

CMD java $JVM_OPTS -jar /usr/share/app.jar
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,36 @@ By participating in this project, you agree to abide by its [Code of Conduct](./
This project follows the [REUSE standard for software licensing](https://reuse.software/).
Each file contains copyright and license information, and license texts can be found in the [./LICENSES](./LICENSES) folder. For more information visit https://reuse.software/.

## Building

### Packaging the application

This project is built with [Maven](https://maven.apache.org/). It is validated to be compatible with version 3.9.x. To build the project, run:

```bash
./mvnw clean package
```

This will build the project and run all tests. The resulting artifacts will be placed in the `target` directory.

### Building the Docker image

The project contains a Dockerfile that can be used to build a Docker image. To build the image, run:

```bash
docker build --platform linux/amd64 -t jumper.
ch-braun marked this conversation as resolved.
Show resolved Hide resolved
```

This will build the image and tag it as `jumper:latest`.

### Multi-stage Docker build

Alternatively, you can use the multi-stage Docker build to build the image. This will build the application in a Maven container and then copy the resulting artifacts into a smaller container. To build the image, run:

```bash
docker build --platform linux/amd64 -t jumper -f Dockerfile.multi-stage .
```

## Scenarios
Scenarios from various aspects of Jumper functionality perspective. <b>Scenarios from different perspective can be overlapping!</b>

Expand Down
Empty file modified mvnw
100644 → 100755
Empty file.