Skip to content

Commit

Permalink
speedrun to clone MAL lists [4/n]
Browse files Browse the repository at this point in the history
fix: downgrade corretto from 22 to 21;
setup maven in another layer with pre-build binaries
instead of fetch with alpine package manager.

todo: whole app
todo: fix the sed syntax for appending maven into the pom.xml in the
setup shellscript.
  • Loading branch information
deomorxsy committed Apr 6, 2024
1 parent 065beb3 commit 3713fdc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
26 changes: 21 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM alpine:3.18

#ARG version=8.382.05.1
ARG version=22.0.0.37
#ARG version=22.0.0.37.1; builds, no maven
ARG version=21.0.2.14.1
# works with maven

#slim build with jlink to keep jre size at a minimum
RUN wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads/resources/licenses/alpine/THIRD-PARTY-LICENSES-20200824.tar.gz && \
Expand All @@ -12,17 +14,31 @@ RUN wget -O /THIRD-PARTY-LICENSES-20200824.tar.gz https://corretto.aws/downloads
SHA_SUM="6cfdf08be09f32ca298e2d5bd4a359ee2b275765c09b56d514624bf831eafb91" && \
echo "${SHA_SUM} /etc/apk/keys/amazoncorretto.rsa.pub" | sha256sum -c - && \
echo "https://apk.corretto.aws" >> /etc/apk/repositories && \
apk add --no-cache amazon-corretto-22=$version-r0 binutils maven && \
apk add --no-cache amazon-corretto-21=$version-r0 binutils && \
/usr/lib/jvm/default-jvm/bin/jlink --add-modules "$(java --list-modules | sed -e 's/@[0-9].*$/,/' | tr -d \\n)" --no-man-pages --no-header-files --strip-debug --output /opt/corretto-slim && \
apk del binutils amazon-corretto-20 && \
apk del binutils amazon-corretto-21 && \
mkdir -p /usr/lib/jvm/ && \
mv /opt/corretto-slim /usr/lib/jvm/java-22-amazon-corretto && \
ln -sfn /usr/lib/jvm/java-22-amazon-corretto /usr/lib/jvm/default-jvm
mv /opt/corretto-slim /usr/lib/jvm/java-21-amazon-corretto && \
ln -sfn /usr/lib/jvm/java-21-amazon-corretto /usr/lib/jvm/default-jvm


ENV LANG C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/default-jvm
#ENV JAVA_HOME="$(/usr/libexec/java_home -v 21)"
ENV PATH=$PATH:/usr/lib/jvm/default-jvm/bin

# ====== maven setup, new layer ======
ENV MAVEN_VERSION 3.9.2
ENV MAVEN_HOME /usr/lib/mvn
ENV PATH $MAVEN_HOME/bin:$PATH

RUN wget http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz && \
tar -zxvf apache-maven-$MAVEN_VERSION-bin.tar.gz && \
rm apache-maven-$MAVEN_VERSION-bin.tar.gz && \
mv apache-maven-$MAVEN_VERSION /usr/lib/mvn

# ====================

ARG APPLICATION_USER=appuser
RUN adduser --no-create-home -u 1000 -D $APPLICATION_USER && \
mkdir /app && \
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

A speedrun attempt to clone [MAL](https://myanimelist.net/) lists into a github pages subdomain, using SpringBoot. IaC automation provided by OCI containers, compose, github actions and scaffolding with shellscript.

The second attempt is to make the app ~**blazingly**~ fast by having a slim container image build, featuring:
- alpine as OCI container distro;
- [amazon-corretto-22]() as JRE;
- symbol stripping with [jlink]();
- to avoid layer bloat, ~only one~ two are being used to download and remove build dependencies. Dockerfile inspired by the official [corretto](https://github.com/corretto/corretto-docker/) repo

## Usage

1. clone repository with SSH and enter directory
Expand Down

0 comments on commit 3713fdc

Please sign in to comment.