chore: simplify docker image generation
Remove the use of a separate builder image
This commit is contained in:
parent
9fb4b577a7
commit
e369875dc7
9 changed files with 62 additions and 70 deletions
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
target/
|
|
@ -33,3 +33,23 @@ jobs:
|
|||
args: release-plz release --backend gitea --git-token ${{ secrets.FORGEJO_TOKEN }}
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
|
||||
docker:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- name: Login to Forgejo
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.kemitix.net
|
||||
username: ${{ vars.FORGEJO_USERNAME }}
|
||||
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./
|
||||
push: true
|
||||
tags: git.kemitix.net/${{ vars.FORGEJO_USERNAME }}/${{ vars.FORGEJO_IMAGE_NAME }}:latest
|
||||
|
|
|
@ -50,3 +50,32 @@ jobs:
|
|||
uses: https://git.kemitix.net/kemitix/rust@v2.5.0
|
||||
with:
|
||||
args: ${{ matrix.toolchain.name }} cargo hack --feature-powerset test
|
||||
|
||||
docker:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Docker info (init)
|
||||
run: docker info
|
||||
|
||||
- name: Login to Forgejo
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.kemitix.net
|
||||
username: ${{ vars.FORGEJO_USERNAME }}
|
||||
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
- name: Docker info (logged in)
|
||||
run: docker info
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Docker info (all setup)
|
||||
run: docker info
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./
|
||||
push: false # don't push on next, only on main
|
||||
tags: git.kemitix.net/${{ vars.FORGEJO_USERNAME }}/${{ vars.FORGEJO_IMAGE_NAME }}:latest
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
steps:
|
||||
|
||||
update-builder-image:
|
||||
when:
|
||||
- event: cron
|
||||
image: docker.io/woodpeckerci/plugin-docker-buildx:latest
|
||||
settings:
|
||||
username: kemitix
|
||||
repo: git.kemitix.net/kemitix/git-next-builder
|
||||
auto_tag: true
|
||||
dockerfile: Dockerfile.builder
|
||||
dry-run: false # push to remote repo
|
||||
registry: git.kemitix.net
|
||||
password:
|
||||
from_secret: woodpecker-docker-push
|
|
@ -1,13 +0,0 @@
|
|||
steps:
|
||||
docker-build:
|
||||
when:
|
||||
- event: push
|
||||
branch: next
|
||||
# INFO: https://woodpecker-ci.org/plugins/Docker%20Buildx
|
||||
image: docker.io/woodpeckerci/plugin-docker-buildx:5.1.0
|
||||
settings:
|
||||
username: kemitix
|
||||
repo: git.kemitix.net/kemitix/git-next
|
||||
dockerfile: Dockerfile
|
||||
auto_tag: false
|
||||
dry-run: true # don't push to remote repo
|
|
@ -1,16 +0,0 @@
|
|||
steps:
|
||||
docker-build:
|
||||
when:
|
||||
- event: tag
|
||||
ref: refs/tags/v*
|
||||
# INFO: https://woodpecker-ci.org/plugins/Docker%20Buildx
|
||||
image: docker.io/woodpeckerci/plugin-docker-buildx:5.1.0
|
||||
settings:
|
||||
username: kemitix
|
||||
repo: git.kemitix.net/kemitix/git-next
|
||||
dockerfile: Dockerfile
|
||||
auto_tag: true
|
||||
dry-run: false # push to remote repo
|
||||
registry: git.kemitix.net
|
||||
password:
|
||||
from_secret: woodpecker-docker-push
|
12
Dockerfile
12
Dockerfile
|
@ -1,6 +1,16 @@
|
|||
# Leveraging the pre-built Docker images with
|
||||
# cargo-chef and the Rust toolchain
|
||||
FROM git.kemitix.net/kemitix/git-next-builder:2024.08.04 AS chef
|
||||
FROM docker.io/rust:1.83.0-bookworm AS chef
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libdbus-1-dev && \
|
||||
curl -L https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz -o cargo-binstall.tgz && \
|
||||
tar -xzf cargo-binstall.tgz && \
|
||||
rm cargo-binstall.tgz && \
|
||||
mv cargo-binstall /usr/local/bin/ && \
|
||||
cargo binstall -y cargo-chef && \
|
||||
rustup component add rustfmt clippy
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
FROM chef AS planner
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
FROM docker.io/rust:1.83.0-bookworm
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libdbus-1-dev && \
|
||||
curl -L https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz -o cargo-binstall.tgz && \
|
||||
tar -xzf cargo-binstall.tgz && \
|
||||
rm cargo-binstall.tgz && \
|
||||
mv cargo-binstall /usr/local/bin/ && \
|
||||
cargo binstall -y cargo-chef && \
|
||||
rustup component add rustfmt clippy
|
||||
|
||||
# verify that the binaries are installed
|
||||
RUN ls -l /usr/local/cargo/bin/
|
||||
RUN cargo chef --version
|
||||
RUN rustfmt --version
|
||||
RUN cargo fmt --version
|
||||
RUN cargo clippy --version
|
||||
RUN cargo --version
|
||||
RUN rustc --version
|
||||
RUN rustup --version
|
||||
RUN rustup show
|
5
justfile
5
justfile
|
@ -60,10 +60,7 @@ grcov-coverage:
|
|||
find . -name '*.profraw' -exec rm "{}" \;
|
||||
echo "Now:\n\topen target/debug/coverage/index.html"
|
||||
|
||||
docker-build-builder:
|
||||
docker build -t git.kemitix.net/kemitix/git-next-builder:2024.08.04 -f Dockerfile.builder .
|
||||
|
||||
docker-build: docker-build-builder
|
||||
docker-build:
|
||||
docker build -t git.kemitix.net/kemitix/git-next:latest .
|
||||
|
||||
docker-run: docker-build
|
||||
|
|
Loading…
Reference in a new issue