0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Liberty on Alpine Linux Part4

Last updated at Posted at 2024-05-26

Liberty on Alpine Linux Part3で Alpine Linux 3.18.6 で Liberty を動かしています。
Alpine Linux 3.19.1/3.20.0 がリリースされましたが、Javaのインストール時や Liberty の実行で失敗します。
そこでsgerrand glibcではなく、distroless から glibc のライブラリを取得して、環境構築してみましょう。
distroless は Googleが提供している必要最小限の依存のみが含まれるDebian10(buster)を基に作成されたコンテナイメージ です。日本語対応したいなぁ。
distroless の分かりやすいサイトとして以下があります。https://zenn.dev/yoshii0110/articles/21ddb58c6f6bfa
ありがとうございます。
Liberty on Alpine Linux Part2も更新しました。OpenJDKなら簡単に動くようですね(^^;

Dockerfile例

dockerfile
FROM gcr.io/distroless/cc-debian12:latest AS cc
FROM kazu_alpine_jp:3.20.0
ENV LD_LIBRARY_PATH="/usr/local/lib"
COPY --from=cc --chown=root:root --chmod=755 /lib/*-linux-gnu/* /usr/local/lib/
RUN mkdir /lib64 && ln -s /usr/local/lib/ld-linux-*.so.2 /lib64/

RUN apk update \
    && apk add --no-cache unzip

ENV JAVA_VERSION 8.0.8.25

RUN set -eux; \
    YML_FILE='jre/linux/x86_64/index.yml'; \
    BASE_URL="https://public.dhe.ibm.com/ibmdl/export/pub/systems/cloud/runtimes/java/meta/8.0"; \
    wget -q -U UA_IBM_JAVA_Docker -O /tmp/index.yml ${BASE_URL}/${YML_FILE}; \
    JAVA_URL=$(sed -n '/^'${JAVA_VERSION}:'/{n;s/\s*uri:\s//p}'< /tmp/index.yml); \
    wget -q -U UA_IBM_JAVA_Docker -O /tmp/ibm-java.bin.tgz ${JAVA_URL}; \
    mkdir -p /opt/ibm; \
    tar xvfz /tmp/ibm-java.bin.tgz -C /opt/ibm; \
    mv /opt/ibm/ibm-java-x86_64-80 /opt/ibm/java

# Install WebSphere Liberty
ENV LIBERTY_VERSION 24.0.0.5

ARG LIBERTY_URL 
ARG DOWNLOAD_OPTIONS=""

RUN LIBERTY_URL="https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/downloads/wlp/${LIBERTY_VERSION}/wlp-kernel-${LIBERTY_VERSION}.zip"  \
    && wget -q $DOWNLOAD_OPTIONS $LIBERTY_URL -U UA-IBM-WebSphere-Liberty-Docker -O /tmp/wlp.zip \
    && unzip -q /tmp/wlp.zip -d /opt/ibm \
    && rm /tmp/wlp.zip

ENV JAVA_HOME=/opt/ibm/java/jre \
    PATH=/opt/ibm/java/jre/bin:/opt/ibm/wlp/bin:$PATH \
    IBM_JAVA_OPTIONS="-XX:+UseContainerSupport" \
    LANG=ja_JP.UTF-8 LANGUAGE=ja_JP.UTF-8

RUN /opt/ibm/wlp/bin/server create
RUN /opt/ibm/wlp/bin/installUtility install defaultServer

EXPOSE 9080 9443

CMD ["/opt/ibm/wlp/bin/server", "run", "defaultServer"]

起動メッセージ

起動すると以下のメッセージが出力されました。

Launching defaultServer (WebSphere Application Server 24.0.0.5/wlp-1.0.89.cl240520240506-1951) on IBM J9 VM, version 8.0.8.25 - pxa6480sr8fp25-20240328_01(SR8 FP25) (en_US)
[AUDIT   ] CWWKE0001I: The server defaultServer has been launched.
[AUDIT   ] CWWKE0100I: This product is licensed for development, and limited production use. The full license terms can be viewed here: https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/license/base_ilan/ilan/24.0.0.5/lafiles/en.html
[WARNING ] CWWKF0009W: The server has not been configured to install any features.
[AUDIT   ] CWWKF0012I: The server installed the following features: [].
[AUDIT   ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 1.893 seconds.

Dockerイメージのサイズは Alpine Linux 3.18.6 ベースより小さいです。さらに小さいのが OpenJDK を使ったものですね(^^;

$ docker images
REPOSITORY                            TAG             IMAGE ID       CREATED         SIZE
kazu_liberty_glibc                    24.0.0.5        4d4d413a80e1   8 seconds ago   384MB
kazu_liberty                          24.0.0.5        38558569b0f1   5 days ago      444MB
kazu_alpine_jp                        3.20.0          ca8573ae4b74   7 minutes ago   10.1MB
kazu_liberty_openjdk                  24.0.0.5        54ff86ea9f68   26 minutes ago  314MB

特徴

・最新のAlpineをベースにしていて、scratchから構築している。

変更履歴

(2024/05/26)新規作成

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?