-
Notifications
You must be signed in to change notification settings - Fork 3
Minimize Docker images and automate relasing docker images #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f9b360a
Initial plan
Copilot ef5bd54
Implement multi-stage Docker builds to minimize image size
Copilot 6191e7b
Add comprehensive size reduction summary documentation
Copilot 1bae142
Remove OPTIMIZATION.md and SIZE_REDUCTION_SUMMARY.md documentation files
Copilot 213f64c
fix: Dockerfile and utf8.Dockerfile
yutaro-sakamoto c38cfa5
build: add build configuration files
yutaro-sakamoto 788e35b
fix: update docker-compose.yml
yutaro-sakamoto 404bf58
ci: run example programs in a Docker container
yutaro-sakamoto adf457b
chore: rename Makefile to run.sh
yutaro-sakamoto ba7efad
fix: copying built files
yutaro-sakamoto 4b3008d
fix: CLASSPATH defined in Dockerfile
yutaro-sakamoto a8ab90d
ci: improve workflow triggers
yutaro-sakamoto 1485e43
ci: add experimental code that pushes docker images to DockerHub
yutaro-sakamoto 7337234
fix: create an image with the tag `latest`
yutaro-sakamoto db01936
ci: deploy only when workflow_dispatch
yutaro-sakamoto 02d23f8
ci: change settings to disable debug mode
yutaro-sakamoto 66b71ff
build: change build-config.json to release new images
yutaro-sakamoto a9ccf44
doc: update README.md
yutaro-sakamoto 9373b44
fix: apply copilot suggestions
yutaro-sakamoto 0576c64
chore: update Dockerfile
yutaro-sakamoto abacea8
ci: add checks of versions of installed software
yutaro-sakamoto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,91 @@ | ||
name: test | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
pull_request: | ||
types: [opened, reopened, review_requested, synchronize] | ||
types: [opened, reopened, synchronize] | ||
workflow_dispatch: | ||
inputs: | ||
push_to_dockerhub: | ||
description: 'Push to Docker Hub' | ||
required: false | ||
default: 'false' | ||
type: boolean | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
uses: actions/checkout@v5 | ||
|
||
- name: Load configuration | ||
run: | | ||
echo opensource_COBOL_4J_version="$(jq -r '.opensource_COBOL_4J_version' build-config.json)" >> $GITHUB_ENV | ||
echo Open_COBOL_ESQL_4J_version="$(jq -r '.Open_COBOL_ESQL_4J_version' build-config.json)" >> $GITHUB_ENV | ||
echo version_string_prefix="$(jq -r '.version_string_prefix' build-config.json)" >> $GITHUB_ENV | ||
|
||
- name: Build a docker image | ||
run: docker build -t opensourcecobol/opensourcecobol4j . | ||
run: | | ||
docker build -t opensourcecobol/opensourcecobol4j:"$version_string_prefix" . \ | ||
--build-arg opensource_COBOL_4J_version="$opensource_COBOL_4J_version" \ | ||
--build-arg Open_COBOL_ESQL_4J_version="$Open_COBOL_ESQL_4J_version" | ||
|
||
- name: Copy Docker image | ||
run: | | ||
docker tag opensourcecobol/opensourcecobol4j:"$version_string_prefix" opensourcecobol/opensourcecobol4j:latest | ||
|
||
- 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'" | ||
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: 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 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Push to Docker Hub | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' && inputs.push_to_dockerhub == 'true' | ||
run: | | ||
docker push opensourcecobol/opensourcecobol4j:"$version_string_prefix" | ||
docker push opensourcecobol/opensourcecobol4j:latest | ||
|
||
utf8-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
uses: actions/checkout@v5 | ||
|
||
- name: Load configuration | ||
run: | | ||
echo opensource_COBOL_4J_version="$(jq -r '.opensource_COBOL_4J_version' build-config.json)" >> $GITHUB_ENV | ||
echo Open_COBOL_ESQL_4J_version="$(jq -r '.Open_COBOL_ESQL_4J_version' build-config.json)" >> $GITHUB_ENV | ||
echo version_string_prefix="$(jq -r '.version_string_prefix' build-config.json)" >> $GITHUB_ENV | ||
|
||
- name: Build a docker image | ||
run: docker build -t opensourcecobol/opensourcecobol4j:utf8 . -f utf8.Dockerfile | ||
run: | | ||
docker build -t opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" . -f utf8.Dockerfile \ | ||
--build-arg opensource_COBOL_4J_version="$opensource_COBOL_4J_version" | ||
|
||
- 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 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Push to Docker Hub | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' && inputs.push_to_dockerhub == 'true' | ||
run: | | ||
docker push opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,26 @@ | ||
# opensource COBOL 4J development environment (Docker) | ||
このリポジトリでは、GitHub Actionsを使用して、opensource COBOL 4J及びOpen COBOL ESQL 4JのインストールされたDockerイメージのリリースを行います。 | ||
|
||
## Docker image | ||
Versions : | ||
# リリース手順 | ||
|
||
- OS: Ubuntu | ||
- opensource COBOL 4J: v1.1.7 | ||
- Open COBOL ESQL 4J: v1.1.1 | ||
## build-config.jsonの編集 | ||
|
||
In order to "Hello World" program, run the following commands in the docker container | ||
リリースするバージョンに合わせて、build-config.jsonを編集します。 | ||
* opensource_COBOL_4J_version: Dockerイメージにインストールするopensource COBOL 4Jのバージョン | ||
* Open_COBOL_ESQL_4J_version: DockerイメージにインストールするOpen COBOL ESQL 4Jのバージョン | ||
* version_string_prefix: リリースするDockerイメージタグのプレフィックス | ||
* 例えば20250929を指定すると、以下の3つのタグを持つDockerイメージがビルドされ、Docker Hubにプッシュされます。 | ||
* opensourcecobol/opensourcecobol4j:20250929 | ||
* opensourcecobol/opensourcecobol4j:20250929-utf8 | ||
* opensourcecobol/opensourcecobol4j:latest | ||
|
||
``` | ||
cd /root/cobol_sample | ||
cobj HELLO.cbl | ||
java HELLO | ||
``` | ||
## ワークフローの手動実行 | ||
|
||
## Docker containers | ||
[公式ドキュメント](https://docs.github.com/ja/actions/how-tos/manage-workflow-runs/manually-run-a-workflow)を参考にして、ワークフローを手動で実行します。 | ||
|
||
In order to launch the environment with a database server and a client with opensource COBOL 4J Open COBOL ESQL 4J installed, run the following command. | ||
* ワークフロー名: `Build and Push Docker Image` | ||
* ブランチ: `main` | ||
* 入力パラメータ: `push_to_dockerhub`に`true`を指定 | ||
|
||
```bash | ||
cd docker-compose | ||
docker compose up -d | ||
docker attach oc4j_client | ||
``` | ||
これによりDockerイメージがビルドされ、Docker HubにDockerイメージがプッシュされます。 | ||
|
||
Run the following in the docker container and execute sample programs of Open COBOL ESQL 4J. | ||
|
||
```bash | ||
cd /root/ocesql4j_sample | ||
make | ||
``` | ||
|
||
Copyright 2021-2024, Tokyo System House Co., Ltd. <opencobol@tsh-world.co.jp> | ||
Copyright 2021-2025, Tokyo System House Co., Ltd. <opencobol@tsh-world.co.jp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"opensource_COBOL_4J_version": "1.1.13", | ||
"Open_COBOL_ESQL_4J_version": "1.1.2", | ||
"version_string_prefix": "20250929" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ocesql INSERTTBL.cbl INSERTTBL.cob | ||
ocesql FETCHTBL.cbl FETCHTBL.cob | ||
cobj *.cob | ||
java INSERTTBL | ||
java FETCHTBL | ||
yutaro-sakamoto marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.