From 10fe516be695d588e1839970b42cce5e121627ec Mon Sep 17 00:00:00 2001 From: abap34 Date: Tue, 2 Apr 2024 16:46:02 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Dockerfile=20=E3=82=92=E6=95=B4=E5=82=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 11 +++++++++++ docker-entrypoint.sh | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 Dockerfile create mode 100755 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dd834f2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM alpine:latest + +RUN apk add --no-cache g++ + +WORKDIR /app + +COPY . . + +RUN sh build.sh + +ENTRYPOINT [ "./docker-entrypoint.sh" ] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..5d247a2 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exec /app/build/almo "$@" \ No newline at end of file From e58e142857bf299cb72a7d4c0b257775b6bcacac Mon Sep 17 00:00:00 2001 From: abap34 Date: Tue, 2 Apr 2024 16:46:26 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=83=AA=E3=83=AA=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E6=99=82=E3=81=AB=20DockerHub=20=E3=81=AB=E3=82=A4=E3=83=A1?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=82=92=E3=82=A2=E3=83=83=E3=83=97=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dockerhub.yaml | 26 ++++++++++++++++++++++++++ .github/workflows/release.yaml | 30 ++++++++++++++++++++++++++++++ build.sh | 2 -- 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/dockerhub.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/dockerhub.yaml b/.github/workflows/dockerhub.yaml new file mode 100644 index 0000000..f797e8c --- /dev/null +++ b/.github/workflows/dockerhub.yaml @@ -0,0 +1,26 @@ +name: Build and push Docker image + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/almo:latest \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..5087fe3 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,30 @@ +name: Release for all platforms + +on: + release: + types: [published] + +jobs: + build_and_upload: + runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-14] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build + run: sh build.sh + + - name: Upload Release + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: build/main + asset_name: ${{ matrix.os }} + asset_content_type: application/octet-stream + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/build.sh b/build.sh index 7227bff..1c6d42f 100755 --- a/build.sh +++ b/build.sh @@ -26,6 +26,4 @@ done g++ -std=c++20 "$build_dir"almo.cpp -o "$build_dir"almo -mv "$build_dir"almo . - echo "ビルドが完了しました。"