-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove unecessary println && add publish workflow
- Loading branch information
Showing
3 changed files
with
85 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: "Release docker image" | ||
run-name: "Release docker image: ${{ github.event.release.name }} ⛑️" | ||
|
||
on: | ||
push: | ||
# release: | ||
# types: [published] | ||
|
||
jobs: | ||
docker: | ||
name: Docker | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ github.repository }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
id: buildx | ||
|
||
- name: Inspect builder | ||
run: | | ||
echo "Name: ${{ steps.buildx.outputs.name }}" | ||
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" | ||
echo "Status: ${{ steps.buildx.outputs.status }}" | ||
echo "Flags: ${{ steps.buildx.outputs.flags }}" | ||
echo "Platforms: ${{ steps.buildx.outputs.platforms }}" | ||
# - name: Login to DockerHub | ||
# uses: docker/login-action@v2 | ||
# if: github.event_name != 'pull_request' | ||
# with: | ||
# username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
# password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
id: docker_build | ||
with: | ||
builder: ${{ steps.buildx.outputs.name }} | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: false | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,28 @@ | ||
FROM --platform=$BUILDPLATFORM rust:bookworm as vendor | ||
ARG BUILDPLATFORM | ||
ARG TARGETPLATFORM | ||
RUN echo "Running on: $BUILDPLATFORM / Building for $TARGETPLATFORM" | ||
WORKDIR /app | ||
|
||
COPY ./Cargo.toml . | ||
#COPY ./Cargo.lock . | ||
COPY ./src src | ||
RUN mkdir .cargo && cargo vendor > .cargo/config.toml | ||
|
||
FROM rust:bookworm as builder | ||
WORKDIR /app | ||
|
||
COPY --from=vendor /app/.cargo .cargo | ||
COPY --from=vendor /app/vendor vendor | ||
COPY ./Cargo.toml . | ||
#COPY ./Cargo.lock . | ||
COPY ./src src | ||
RUN cargo build --release | ||
|
||
FROM debian:bookworm-slim | ||
WORKDIR /app | ||
ENV RUST_BACKTRACE=full | ||
COPY --from=builder /app/target/release/livebox-exporter-rs livebox-exporter-rs | ||
|
||
EXPOSE 9100 | ||
ENTRYPOINT ["/app/livebox-exporter-rs"] |
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