Commit be4108c6 authored by Christian Hofer's avatar Christian Hofer Committed by Georg Mittendorfer

instructions to build a piri docker image

parent bf1f0ae6
Pipeline #29671248 passed with stage
in 3 minutes and 6 seconds
# Build artifact
mvn clean package -DskipTests
# Instructions using docker CLI
## Build image
docker build -t piri .
## Start image in container
docker run -v ${PWD}/docker-custom.properties:/application.properties -p 80:8080 piri
curl http://127.0.0.1/actuator/health
## Tag and push image to registry (https://hub.docker.com/r/chrisss404/piri/)
# login if not already authenticated
docker login --username=yourhubusername
docker tag piri chrisss404/piri:latest
docker push chrisss404/piri
# Instructions using docker compose
## Build image
docker-compose build
## Start image in container
docker-compose up
curl http://127.0.0.1/actuator/health
## Tag and push image to registry (https://hub.docker.com/r/chrisss404/piri/)
docker-compose push
FROM openjdk:8-jre-alpine
# runtime dependency for tomcat native libraries
RUN apk add --no-cache tomcat-native && \
rm -rf /var/cache/apk/*
# vendor files
COPY target/unpacked-jar/BOOT-INF/lib /app/BOOT-INF/lib
COPY target/unpacked-jar/org /app/org
# app files
COPY target/unpacked-jar/META-INF /app/META-INF
COPY target/unpacked-jar/BOOT-INF/classes /app/BOOT-INF/classes
ENTRYPOINT ["/usr/bin/java", "-Djava.security.egd=file:/dev/./urandom", "-XX:+UnlockExperimentalVMOptions", \
"-XX:+UseCGroupMemoryLimitForHeap", "-XX:MaxRAMFraction=1", "-cp", "/app", \
"org.springframework.boot.loader.JarLauncher"]
EXPOSE 8080
version: '2'
services:
piri:
build: .
image: chrisss404/piri:latest
ports:
- 80:8080
volumes:
- ./docker-custom.properties:/application.properties
spring.security.user.name=piri
spring.security.user.password=docker
......@@ -70,6 +70,31 @@
<tag>v${project.version}</tag>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-jar</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<includes>**/*</includes>
<outputDirectory>${project.build.directory}/unpacked-jar</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment