Skip to content

Commit

Permalink
Add: Add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Oct 2, 2023
1 parent 20ba1fa commit e8ff660
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
47 changes: 24 additions & 23 deletions .github/workflows/sub-image-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,36 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sub-image
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version-file: sub-image/.python-version
- name: Install poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.3.1
- name: Config poetry
run: poetry config virtualenvs.create false
- name: Cache venv
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install dependencies
working-directory: ./sub-image
run: poetry install
- name: Setup rust
run: |
rustup toolchain install
rustup target add aarch64-unknown-linux-gnu
- name: Cache target
uses: Swatinem/rust-cache@v2
- name: Run check
run: |
cargo clippy
cargo fmt -- --check
cargo test
- name: Run sub-image lint
working-directory: ./sub-image
- name: Build binary
if: github.ref_name == 'main'
working-directory: .
run: |
poetry run poe lint
cargo build --release --target x86_64-unknown-linux-gnu
cargo build --release --target aarch64-unknown-linux-gnu
mkdir /tmp/sub-image/arm64 -p
mkdir /tmp/sub-image/amd64 -p
cp target/x86_64-unknown-linux-gnu/release/sub-image /tmp/sub-image/amd64/sub-image
cp target/aarch64-unknown-linux-gnu/release/sub-image /tmp/sub-image/arm64/sub-image
- name: Build image
if: github.ref_name == 'main'
uses: ./.github/actions/build
Expand Down
6 changes: 6 additions & 0 deletions sub-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ubuntu:22.04
ARG TARGETARCH
COPY /tmp/sub-image/${TARGETARCH}/sub-image /app/sub-image

WORKDIR /app
ENTRYPOINT ["/app/sub-image"]

0 comments on commit e8ff660

Please sign in to comment.