Skip to content

Commit

Permalink
feat: docker
Browse files Browse the repository at this point in the history
  • Loading branch information
pxseu committed Mar 11, 2024
1 parent 44f6a0b commit 1d13a1a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target
test
.github
LICENSE
README.md
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,24 @@ jobs:

- name: Publish Crates
run: cargo publish --locked --no-verify

publish-docker:
name: Publish Docker
needs: ["draft-release", "build-release"]
runs-on: ubuntu-latest
continue-on-error: true
environment: prod
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Login to Docker
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin

- name: Build Docker Image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ env.EXECUTABLE_NAME }}:${{ needs.draft-release.outputs.tag_name }} .

- name: Push Docker Image
run: docker push ${{ secrets.DOCKER_USERNAME }}/${{ env.EXECUTABLE_NAME }}:${{ needs.draft-release.outputs.tag_name }}
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM rust:alpine as builder

WORKDIR /app

RUN apk add --no-cache musl-dev

COPY . .

RUN cargo build --release --target x86_64-unknown-linux-musl

# main image

FROM alpine:latest

ARG BIN_NAME=crabdis

COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/${BIN_NAME} /usr/local/bin/${BIN_NAME}

ENTRYPOINT [ "/usr/local/bin/crabdis"]

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ You can find binaries on the [releases page](https://github.com/pxseu/crabdis/re

If you want to install it with cargo, you can do so with `cargo install crabdis`.

There is also a Docker image available on [Docker Hub](https://hub.docker.com/r/pxseu/crabdis).

# Usage

```sh
Expand Down

0 comments on commit 1d13a1a

Please sign in to comment.