Skip to content

Commit

Permalink
Merge pull request #16 from uherberg/uherberg-small-container
Browse files Browse the repository at this point in the history
use small container
  • Loading branch information
uherberg authored Dec 8, 2022
2 parents 35ba7d7 + 5b33d68 commit 028a456
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: PR check

on:
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- name: Build with Maven
run:
mvn clean package --file pom.xml

- name: Build the Docker image
run: docker build . --file Dockerfile --tag ebay/digital-signature-verification-ebay-api:latest
32 changes: 31 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
FROM openjdk:11
FROM azul/zulu-openjdk-alpine:11 as packager

RUN { \
java --version ; \
echo "jlink version:" && \
jlink --version ; \
}

ENV JAVA_MINIMAL=/opt/jre

# build modules distribution
RUN jlink \
--verbose \
--add-modules \
java.base,java.sql,java.naming,java.desktop,java.management,java.security.jgss,java.instrument \
# java.naming - javax/naming/NamingException
# java.desktop - java/beans/PropertyEditorSupport
# java.management - javax/management/MBeanServer
# java.security.jgss - org/ietf/jgss/GSSException
# java.instrument - java/lang/instrument/IllegalClassFormatException
--compress 2 \
--strip-debug \
--no-header-files \
--no-man-pages \
--output "$JAVA_MINIMAL"

# Second stage, add only our minimal "JRE" distr and our app
FROM alpine
ENV JAVA_MINIMAL=/opt/jre
ENV PATH="$PATH:$JAVA_MINIMAL/bin"
COPY --from=packager "$JAVA_MINIMAL" "$JAVA_MINIMAL"
WORKDIR /home/nouser/
COPY src/main/resources/keys src/main/resources/keys
COPY target/signaturevalidation*.jar .
Expand Down

0 comments on commit 028a456

Please sign in to comment.