Skip to content

Commit

Permalink
Merge pull request #153 from Kuadrant/build-images-with-redhat-actions
Browse files Browse the repository at this point in the history
GH action build image using redhat-actions/buildah-build@v2
  • Loading branch information
eguzki authored Mar 13, 2023
2 parents eb286f4 + e789e47 commit b46f66d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 38 deletions.
39 changes: 19 additions & 20 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,29 @@ jobs:
id: add-latest-tag
run: |
echo "IMG_TAGS=latest" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Login to Quay.io
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}
username: ${{ secrets.IMG_REGISTRY_USERNAME }}
password: ${{ secrets.IMG_REGISTRY_TOKEN }}

- name: Build and Push Image
uses: docker/build-push-action@v4
uses: docker/setup-qemu-action@v2
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
context: .
file: ./Dockerfile
image: limitador
tags: ${{ env.IMG_TAGS }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/limitador:${{ env.IMG_TAGS }}
dockerfiles: |
./Dockerfile
build-args: |
GITHUB_SHA=${{ github.sha }}
- name: Push Image
if: ${{ !env.ACT }}
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}
username: ${{ secrets.IMG_REGISTRY_USERNAME }}
password: ${{ secrets.IMG_REGISTRY_TOKEN }}
- name: Print Image URL
run: |
echo "Image pushed to: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/limitador:${{ env.IMG_TAGS }}"
echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
18 changes: 0 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,10 @@ RUN apk update \

WORKDIR /usr/src/limitador

COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml

COPY limitador/Cargo.toml ./limitador/Cargo.toml
COPY limitador-server/Cargo.toml ./limitador-server/Cargo.toml

ARG GITHUB_SHA
ENV GITHUB_SHA=${GITHUB_SHA:-unknown}
ENV RUSTFLAGS="-C target-feature=-crt-static"

RUN mkdir -p limitador/src limitador-server/src

RUN echo "fn main() {println!(\"if you see this, the build broke\")}" > limitador/src/main.rs \
&& echo "fn main() {println!(\"if you see this, the build broke\")}" > limitador-server/src/main.rs

RUN source $HOME/.cargo/env \
&& cargo build --release --all-features

# avoid downloading and compiling all the dependencies when there's a change in
# our code.
RUN rm -f target/release/deps/limitador*

COPY . .

RUN source $HOME/.cargo/env \
Expand Down

0 comments on commit b46f66d

Please sign in to comment.