Skip to content

Commit

Permalink
Merge pull request #72 from 56quarters/docker
Browse files Browse the repository at this point in the history
Build and push docker images on tags and merges to master
  • Loading branch information
56quarters authored Oct 7, 2023
2 parents ccf3da8 + 2d97654 commit a46d49f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
39 changes: 39 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: docker

on:
push:
tags:
- '*-?v[0-9]+*'
branches:
- 'master'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
56quarters/mtop
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM rust:slim-bookworm AS BUILD
COPY . .
RUN cargo build --release

FROM debian:bookworm-slim
COPY --from=BUILD target/release/mtop /usr/local/bin/
COPY --from=BUILD target/release/mc /usr/local/bin/
CMD ["mtop", "--help"]

0 comments on commit a46d49f

Please sign in to comment.