-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yuki WADA
committed
Apr 11, 2023
1 parent
b4593a6
commit 18be7c5
Showing
8 changed files
with
125 additions
and
89 deletions.
There are no files selected for viewing
This file contains 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 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,97 @@ | ||
name: Release docker images | ||
|
||
on: | ||
push: | ||
branches: | ||
- feature/cross | ||
|
||
jobs: | ||
build: | ||
name: Build for ${{ matrix.docker-platform }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- | ||
docker-platform: linux/amd64 | ||
cross-target: x86_64-unknown-linux-gnu | ||
- | ||
docker-platform: linux/arm64/v8 | ||
cross-target: aarch64-unknown-linux-gnu | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@master | ||
- | ||
name: Setup rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.68.2 | ||
target: ${{ matrix.cross-target }} | ||
override: true | ||
- | ||
name: Build binary using cross | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
command: build | ||
args: --manifest-path server/Cargo.toml --target ${{ matrix.cross-target }} --release | ||
- | ||
name: Upload artifact to collect in next job | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.cross-target }} | ||
path: server/target/${{ matrix.cross-target }}/release/entrypoint | ||
|
||
release-all: | ||
name: Push docker image for all platforms | ||
runs-on: ubuntu-latest | ||
needs: build | ||
env: | ||
image_name: seichi-portal-backend | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@master | ||
- | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: x86_64-unknown-linux-gnu | ||
path: docker/artifacts/x86_64-unknown-linux-gnu | ||
- | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: aarch64-unknown-linux-gnu | ||
path: docker/artifacts/aarch64-unknown-linux-gnu | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
id: prepare_image_id | ||
name: Prepare image id's components | ||
run: | | ||
image_id=ghcr.io/${{ github.repository_owner }}/${{ env.image_name }} | ||
echo "lowercase_id=$(echo $image_id | tr '[A-Z]' '[a-z]')" >> $GITHUB_OUTPUT | ||
echo "short-ref=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT | ||
echo "branch=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_OUTPUT | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: docker | ||
platforms: linux/amd64,linux/arm64/v8 | ||
push: true | ||
tags: | | ||
${{ steps.prepare_image_id.outputs.lowercase_id }}:latest | ||
${{ steps.prepare_image_id.outputs.lowercase_id }}:${{ steps.prepare_image_id.outputs.branch }}-${{ steps.prepare_image_id.outputs.short-ref }} |
This file was deleted.
Oops, something went wrong.
This file contains 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,12 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
FROM ubuntu:latest | ||
LABEL org.opencontainers.image.source=https://github.com/GiganticMinecraft/seichi-portal-backend | ||
|
||
COPY --link / /work/ | ||
RUN ls | ||
COPY /seichi-portal-backend.sh /etc/service/seichi-portal-backend/run | ||
|
||
RUN chmod +x /work/copy-platform-artifact.sh | ||
RUN chmod +x /etc/service/seichi-portal-backend/run | ||
RUN /work/copy-platform-artifact.sh | ||
RUN chmod +x /usr/local/bin/seichi-portal-backend |
This file contains 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,11 @@ | ||
#!/bin/sh | ||
|
||
case $(uname -m) in | ||
# linux/amd64 | ||
"x86_64" ) cp /work/artifacts/x86_64-unknown-linux-gnu/entrypoint /usr/local/bin/seichi-portal-backend ;; | ||
# linux/arm/v7 | ||
"armv7l" ) cp /work/artifacts/armv7-unknown-linux-gnueabihf/entrypoint /usr/local/bin/seichi-portal-backend ;; | ||
# linux/arm64/v8 | ||
"aarch64" ) cp /work/artifacts/aarch64-unknown-linux-gnu/entrypoint /usr/local/bin/seichi-portal-backend ;; | ||
* ) exit 1 # we do not expect other platform | ||
esac |
This file contains 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,2 @@ | ||
#!/bin/sh | ||
exec /usr/local/bin/seichi-poartal-backend |
This file contains 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,4 +1,4 @@ | ||
[toolchain] | ||
channel = "1.68.0" | ||
channel = "1.68.2" | ||
components = [ "rustfmt", "clippy", "cargo" ] | ||
profile = "minimal" |
This file contains 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,2 +0,0 @@ | ||
[build] | ||
target = "x86_64-unknown-linux-musl" | ||