From d7ad5660a8e63e91137a6f9f77407a9f00b70e6a Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Mon, 1 Dec 2025 05:40:51 +0000 Subject: [PATCH 1/8] build: change the base image to almalinux:9-minimal --- Dockerfile | 18 +++++++++--------- utf8.Dockerfile | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index a2e3e48..6d21e58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ # Build stage -FROM almalinux:9 AS builder +FROM almalinux:9-minimal AS builder ARG opensource_COBOL_4J_version=dummy_value Open_COBOL_ESQL_4J_version=dummy_value SHELL ["/bin/bash", "-c"] # install build dependencies -RUN dnf update -y && \ - dnf install -y gcc make bison flex automake autoconf diffutils gettext java-11-openjdk-devel && \ - dnf clean all +RUN microdnf update -y && \ + microdnf install -y gcc make bison flex automake autoconf diffutils gettext java-11-openjdk-devel tar gzip && \ + microdnf clean all # install sbt RUN curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && \ @@ -43,17 +43,17 @@ RUN cd /root/ && \ rm -rf /root/Open-COBOL-ESQL-4j-${Open_COBOL_ESQL_4J_version}.tar.gz /root/Open-COBOL-ESQL-4j-${Open_COBOL_ESQL_4J_version} # Runtime stage -FROM almalinux:9 +FROM almalinux:9-minimal ARG opensource_COBOL_4J_version=dummy_value Open_COBOL_ESQL_4J_version=dummy_value SHELL ["/bin/bash", "-c"] # install runtime dependencies only -RUN dnf update -y && \ - dnf install -y java-11-openjdk-devel && \ - dnf clean all && \ - rm -rf /var/cache/dnf/* +RUN microdnf update -y && \ + microdnf install -y java-11-openjdk-devel && \ + microdnf clean all && \ + rm -rf /var/cache/microdnf/* # create required directories RUN mkdir -p /usr/lib/opensourcecobol4j \ diff --git a/utf8.Dockerfile b/utf8.Dockerfile index 5357d1b..73f6785 100644 --- a/utf8.Dockerfile +++ b/utf8.Dockerfile @@ -1,14 +1,14 @@ # Build stage -FROM almalinux:9 AS builder +FROM almalinux:9-minimal AS builder ARG opensource_COBOL_4J_version=dummy_value SHELL ["/bin/bash", "-c"] # install build dependencies -RUN dnf update -y && \ - dnf install -y gcc make bison flex automake autoconf diffutils gettext java-11-openjdk-devel && \ - dnf clean all +RUN microdnf update -y && \ + microdnf install -y gcc make bison flex automake autoconf diffutils gettext java-11-openjdk-devel tar gzip && \ + microdnf clean all # install sbt RUN curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && \ @@ -28,15 +28,15 @@ RUN cd /root && \ rm -rf /root/opensourcecobol4j-v${opensource_COBOL_4J_version}.tar.gz /root/opensourcecobol4j-${opensource_COBOL_4J_version} # Runtime stage -FROM almalinux:9 +FROM almalinux:9-minimal SHELL ["/bin/bash", "-c"] # install runtime dependencies only -RUN dnf update -y && \ - dnf install -y java-11-openjdk-devel && \ - dnf clean all && \ - rm -rf /var/cache/dnf/* +RUN microdnf update -y && \ + microdnf install -y java-11-openjdk-devel && \ + microdnf clean all && \ + rm -rf /var/cache/microdnf/* # copy built files from builder stage COPY --from=builder /tmp/usr/ /usr/ From 6eefb5173ee49f2b3486db8b97f4948fbdceeb37 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Mon, 1 Dec 2025 05:44:56 +0000 Subject: [PATCH 2/8] ci: show the Docker image size --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 696a37b..c05a078 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,10 @@ jobs: run: | docker tag opensourcecobol/opensourcecobol4j:"$version_string_prefix" opensourcecobol/opensourcecobol4j:latest + - name: Show Docker image size + run: | + docker images opensourcecobol/opensourcecobol4j:"$version_string_prefix" --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" + - name: Check the version of installed software run: | docker run --rm opensourcecobol/opensourcecobol4j:latest sh -c "cobj --version | grep 'opensource COBOL 4J $opensource_COBOL_4J_version'" @@ -73,6 +77,10 @@ jobs: docker build -t opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" . -f utf8.Dockerfile \ --build-arg opensource_COBOL_4J_version="$opensource_COBOL_4J_version" + - name: Show Docker image size + run: | + docker images opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" + - name: Check the version of installed software run: | docker run --rm opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" sh -c "cobj --version | grep 'opensource COBOL 4J $opensource_COBOL_4J_version'" From 31d6001c2f16b001ceb4b9c565cf37564979e725 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Mon, 1 Dec 2025 05:56:05 +0000 Subject: [PATCH 3/8] ci: run simple tests inside the container --- .github/workflows/ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c05a078..f710a79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,12 @@ jobs: docker run --rm opensourcecobol/opensourcecobol4j:latest sh -c "! cobj --version | grep 'unicode/utf-8 support'" docker run --rm opensourcecobol/opensourcecobol4j:latest sh -c "ocesql --version | grep 'Version $Open_COBOL_ESQL_4J_version'" + - name: Run simple tests inside the container + run: | + docker run -itd --name test_container opensourcecobol/opensourcecobol4j:latest + docker exec test_container sh -c "cd /root/cobol_sample && cobj HELLO.cbl && java HELLO" + docker rm -f test_container + - name: Login to Docker Hub if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' && inputs.push_to_dockerhub == true uses: docker/login-action@v3 @@ -81,6 +87,12 @@ jobs: run: | docker images opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" + - name: Run simple tests inside the container + run: | + docker run -itd --name test_container opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" + docker exec test_container sh -c "cd /root/cobol_sample && cobj HELLO.cbl && java HELLO" + docker rm -f test_container + - name: Check the version of installed software run: | docker run --rm opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" sh -c "cobj --version | grep 'opensource COBOL 4J $opensource_COBOL_4J_version'" From 1176e45c032c42c145037994605c55e0df448097 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Mon, 1 Dec 2025 06:04:40 +0000 Subject: [PATCH 4/8] ci: add COPY commands into utf8.Dockerfile --- utf8.Dockerfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/utf8.Dockerfile b/utf8.Dockerfile index 73f6785..f9a1ad8 100644 --- a/utf8.Dockerfile +++ b/utf8.Dockerfile @@ -39,7 +39,16 @@ RUN microdnf update -y && \ rm -rf /var/cache/microdnf/* # copy built files from builder stage -COPY --from=builder /tmp/usr/ /usr/ +COPY --from=builder /usr/lib/opensourcecobol4j/ /usr/lib/opensourcecobol4j/ +COPY --from=builder /usr/lib/Open-COBOL-ESQL-4j/ /usr/lib/Open-COBOL-ESQL-4j/ +COPY --from=builder /usr/bin/cob-config /usr/bin/cob-config +COPY --from=builder /usr/bin/cobj /usr/bin/cobj +COPY --from=builder /usr/bin/cobj-api /usr/bin/cobj-api +COPY --from=builder /usr/bin/cobj-idx /usr/bin/cobj-idx +COPY --from=builder /usr/bin/cobjrun /usr/bin/cobjrun +COPY --from=builder /usr/bin/ocesql /usr/bin/ocesql +COPY --from=builder /usr/include/libcobj.h /usr/include/libcobj.h +COPY --from=builder /usr/share/opensource-cobol-4j-${opensource_COBOL_4J_version} /usr/share/opensource-cobol-4j-${opensource_COBOL_4J_version} # classpath settings ENV CLASSPATH=:/usr/lib/opensourcecobol4j/libcobj.jar From f023a0b7d0fead5eb877024dd9c5bb145cf4212a Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Mon, 1 Dec 2025 06:11:24 +0000 Subject: [PATCH 5/8] fix: add the definition of build arguments --- utf8.Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utf8.Dockerfile b/utf8.Dockerfile index f9a1ad8..56d9a9c 100644 --- a/utf8.Dockerfile +++ b/utf8.Dockerfile @@ -30,6 +30,8 @@ RUN cd /root && \ # Runtime stage FROM almalinux:9-minimal +ARG opensource_COBOL_4J_version=dummy_value + SHELL ["/bin/bash", "-c"] # install runtime dependencies only From c2affbdae70427cbd47b752ee04761074001e510 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Mon, 1 Dec 2025 06:16:30 +0000 Subject: [PATCH 6/8] ci: remove unnecessary COPY commands --- utf8.Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/utf8.Dockerfile b/utf8.Dockerfile index 56d9a9c..843a15c 100644 --- a/utf8.Dockerfile +++ b/utf8.Dockerfile @@ -42,13 +42,11 @@ RUN microdnf update -y && \ # copy built files from builder stage COPY --from=builder /usr/lib/opensourcecobol4j/ /usr/lib/opensourcecobol4j/ -COPY --from=builder /usr/lib/Open-COBOL-ESQL-4j/ /usr/lib/Open-COBOL-ESQL-4j/ COPY --from=builder /usr/bin/cob-config /usr/bin/cob-config COPY --from=builder /usr/bin/cobj /usr/bin/cobj COPY --from=builder /usr/bin/cobj-api /usr/bin/cobj-api COPY --from=builder /usr/bin/cobj-idx /usr/bin/cobj-idx COPY --from=builder /usr/bin/cobjrun /usr/bin/cobjrun -COPY --from=builder /usr/bin/ocesql /usr/bin/ocesql COPY --from=builder /usr/include/libcobj.h /usr/include/libcobj.h COPY --from=builder /usr/share/opensource-cobol-4j-${opensource_COBOL_4J_version} /usr/share/opensource-cobol-4j-${opensource_COBOL_4J_version} From e1b5c224bedb0c2c09d805de002727b2b14b40b7 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Mon, 1 Dec 2025 06:20:34 +0000 Subject: [PATCH 7/8] fix: the value of the option `--prefix` --- utf8.Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utf8.Dockerfile b/utf8.Dockerfile index 843a15c..2b7c750 100644 --- a/utf8.Dockerfile +++ b/utf8.Dockerfile @@ -20,8 +20,7 @@ RUN cd /root && \ curl -L -o opensourcecobol4j-v${opensource_COBOL_4J_version}.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v${opensource_COBOL_4J_version}.tar.gz && \ tar zxvf opensourcecobol4j-v${opensource_COBOL_4J_version}.tar.gz && \ cd opensourcecobol4j-${opensource_COBOL_4J_version} && \ - mkdir -p /tmp/usr/ &&\ - ./configure --prefix=/tmp/usr/ --enable-utf8 && \ + ./configure --prefix=/usr/ --enable-utf8 && \ touch cobj/*.m4 && \ make && \ make install && \ From 999cd4b3babd0bf47441dfe7efea9d7472b0fd16 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Mon, 1 Dec 2025 07:21:07 +0000 Subject: [PATCH 8/8] ci: change the order of verifications --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f710a79..d47d59e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,17 +87,17 @@ jobs: run: | docker images opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" + - name: Check the version of installed software + run: | + docker run --rm opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" sh -c "cobj --version | grep 'opensource COBOL 4J $opensource_COBOL_4J_version'" + docker run --rm opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" sh -c "cobj --version | grep 'unicode/utf-8 support'" + - name: Run simple tests inside the container run: | docker run -itd --name test_container opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" docker exec test_container sh -c "cd /root/cobol_sample && cobj HELLO.cbl && java HELLO" docker rm -f test_container - - name: Check the version of installed software - run: | - docker run --rm opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" sh -c "cobj --version | grep 'opensource COBOL 4J $opensource_COBOL_4J_version'" - docker run --rm opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" sh -c "cobj --version | grep 'unicode/utf-8 support'" - - name: Login to Docker Hub if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' && inputs.push_to_dockerhub == true uses: docker/login-action@v3