Skip to content

Commit

Permalink
Merge pull request #2 from telekom/add-build-instructions
Browse files Browse the repository at this point in the history
Added build instructions and alternative multi-stage Dockerfile.
  • Loading branch information
tomiska123 authored Feb 16, 2024
2 parents d38cc08 + 98c2051 commit e7aaac8
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 8 deletions.
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 .
```

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.

0 comments on commit e7aaac8

Please sign in to comment.