Skip to content

Commit

Permalink
Merge pull request #33 from SkywardAI/feat/arm
Browse files Browse the repository at this point in the history
Add support linux/arm64
  • Loading branch information
Aisuko authored Jul 1, 2024
2 parents 5641645 + 6499ff2 commit 66d3066
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 161 deletions.
53 changes: 48 additions & 5 deletions .github/workflows/build_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,61 @@ on:
branches:
- 'main'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true


jobs:
check_building:
name: 'Check building🐳'
strategy:
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
config:
- { dockerfile: "Dockerfile", platforms: "linux/amd64,linux/arm64" }
runs-on: ubuntu-latest
steps:
- name: Check repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# https://github.com/jlumbroso/free-disk-space/tree/54081f138730dfa15788a46383842cd2f914a1be#example
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Get tag name
id: tag
shell: bash
run: |
echo "SHORT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV
- name: Build Docker image
if: startsWith(github.ref, 'refs/tags/') != true && success()
run: |
docker build -t ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::7} .
uses: docker/build-push-action@v4
with:
context: .
push: false
platforms: ${{ matrix.config.platforms }}
tags: "${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${{ env.SHORT_HASH }}"
file: ${{ matrix.config.dockerfile }}
# run: |
# docker build -t ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::7} .
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
with:
config-name: release-drafter.yml
Expand Down
60 changes: 53 additions & 7 deletions .github/workflows/release_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,71 @@ on:
tags:
- 'v*'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
release_image:
name: 'Releasing Image 🐳'
strategy:
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
config:
- { dockerfile: "Dockerfile", platforms: "linux/amd64,linux/arm64" }
runs-on: ubuntu-latest
steps:
- name: Check repository
uses: actions/checkout@v4

- name: Login to Container Registry
uses: docker/login-action@v3
# if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success()
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Release Docker image
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success()

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2

# # https://github.com/jlumbroso/free-disk-space/tree/54081f138730dfa15788a46383842cd2f914a1be#example
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/free-disk-space@main
# with:
# # this might remove tools that are actually needed,
# # if set to "true" but frees about 6 GB
# tool-cache: false

# # all of these default to true, but feel free to set to
# # "false" if necessary for your workflow
# android: true
# dotnet: true
# haskell: true
# large-packages: true
# docker-images: true
# swap-storage: true

- name: Get tag name
id: tag
shell: bash
run: |
echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Print tag name
run: |
docker build -t ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//} .
docker push ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}
echo ${{ env.TAG }}
# - name: Release Docker image
# if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success()
# uses: docker/build-push-action@v4
# with:
# context: .
# push: false
# platforms: ${{ matrix.config.platforms }}
# tags: "${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${{ env.TAG }}"
# file: ${{ matrix.config.dockerfile }}
# run: |
# docker build -t ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//} .
# docker push ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,49 @@ This repo is incubator for containers.
[![Backend CI/CD 🚀](https://github.com/SkywardAI/containers/actions/workflows/release_image.yml/badge.svg)](https://github.com/SkywardAI/containers/actions/workflows/ci.yml)


# Requirements

Docker and docker-compose version see below:

```bash
ubuntu:~$ docker version
Client:
Version: 24.0.7
API version: 1.43
Go version: go1.21.1
Git commit: 24.0.7-0ubuntu2~22.04.1
Built: Wed Mar 13 20:23:54 2024
OS/Arch: linux/amd64
Context: default

Server:
Engine:
Version: 24.0.7
API version: 1.43 (minimum version 1.12)
Go version: go1.21.1
Git commit: 24.0.7-0ubuntu2~22.04.1
Built: Wed Mar 13 20:23:54 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.12
GitCommit:
runc:
Version: 1.1.12-0ubuntu2~22.04.1
GitCommit:
docker-init:
Version: 0.19.0
GitCommit:


ubuntu:~$ docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.10.12
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022

```

# Building image

The project should be developed in a containerized environment which means it should be opened in the container of [Dockerfile](./Dockerfile).
Expand Down
91 changes: 4 additions & 87 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package-mode = false

[tool.poetry.dependencies]
python = "^3.11"
kimchima = "0.5.2"
kimchima = "0.5.4"
alembic = "1.13.1"
argon2-cffi = "23.1.0"
asgi-lifespan = "2.1.0"
Expand Down
Loading

0 comments on commit 66d3066

Please sign in to comment.