chore(ci): publish to docker
* ci: publish to docker * update release.yaml * update Dockerfile
This commit is contained in:
parent
f66e129985
commit
4167e5c07e
3 changed files with 65 additions and 3 deletions
13
.dockerignore
Normal file
13
.dockerignore
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Directories
|
||||||
|
/.git/
|
||||||
|
/.github/
|
||||||
|
/target/
|
||||||
|
/examples/
|
||||||
|
/docs/
|
||||||
|
/benches/
|
||||||
|
/tmp/
|
||||||
|
|
||||||
|
# Files
|
||||||
|
.gitignore
|
||||||
|
*.md
|
||||||
|
LICENSE*
|
45
.github/workflows/release.yaml
vendored
45
.github/workflows/release.yaml
vendored
|
@ -6,8 +6,10 @@ on:
|
||||||
- v[0-9]+.[0-9]+.[0-9]+*
|
- v[0-9]+.[0-9]+.[0-9]+*
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
all:
|
release:
|
||||||
name: All
|
name: Publish to Github Reelases
|
||||||
|
outputs:
|
||||||
|
rc: ${{ steps.check-tag.outputs.rc }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -123,4 +125,41 @@ jobs:
|
||||||
files: ${{ steps.package.outputs.archive }}
|
files: ${{ steps.package.outputs.archive }}
|
||||||
prerelease: ${{ steps.check-tag.outputs.rc == 'true' }}
|
prerelease: ${{ steps.check-tag.outputs.rc == 'true' }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
docker:
|
||||||
|
name: Publish to Docker Hub
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: release
|
||||||
|
steps:
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and push
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
push: ${{ needs.release.outputs.rc == 'false' }}
|
||||||
|
tags: sigoden/duf:latest, sigoden/duf:${{ github.ref_name }}
|
||||||
|
|
||||||
|
publish-crate:
|
||||||
|
name: Publish to crates.io
|
||||||
|
if: ${{ needs.release.outputs.rc == 'false' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: release
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
- name: Publish
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
|
||||||
|
run: cargo publish
|
10
Dockerfile
Normal file
10
Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
FROM rust:1.61 as builder
|
||||||
|
RUN rustup target add x86_64-unknown-linux-musl
|
||||||
|
RUN apt-get update && apt-get install --no-install-recommends -y musl-tools
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
RUN cargo build --target x86_64-unknown-linux-musl --release
|
||||||
|
|
||||||
|
FROM alpine
|
||||||
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/duf /bin/
|
||||||
|
ENTRYPOINT ["/bin/duf"]
|
Loading…
Reference in a new issue