Skip to content

Commit

Permalink
new: added docker workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Jun 23, 2024
1 parent 59c6395 commit 9561b01
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 17 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and Push Docker Images

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
tags: evilsocket/nerve:latest
23 changes: 8 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
FROM lukemathwalker/cargo-chef:latest-rust-alpine as chef
WORKDIR /app
FROM rust:bullseye as builder

FROM chef AS planner
COPY ./Cargo.toml ./Cargo.lock ./
COPY ./src ./src
RUN cargo chef prepare
RUN apt-get update && apt-get install -y libssl-dev ca-certificates cmake git

FROM chef AS builder
COPY --from=planner /app/recipe.json .
RUN cargo chef cook --release
COPY . .
WORKDIR /app
ADD . /app
RUN cargo build --release
RUN mv ./target/release/nerve ./nerve

FROM scratch AS runtime
WORKDIR /app
COPY --from=builder /app/nerve /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/nerve"]
FROM debian:bullseye
RUN apt-get update && apt-get install -y libssl-dev ca-certificates
COPY --from=builder /app/target/release/nerve /usr/bin/nerve
ENTRYPOINT ["/usr/bin/nerve"]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<p align="center">
<!-- <a href="https://github.com/evilsocket/nerve/releases/latest"><img alt="Release" src="https://img.shields.io/github/release/evilsocket/nerve.svg?style=flat-square"></a>
<!-- <a href="https://github.com/evilsocket/nerve/releases/latest"><img alt="Release" src="https://img.shields.io/github/release/evilsocket/nerve.svg?style=flat-square"></a> -->

<a href="https://hub.docker.com/r/evilsocket/nerve"><img alt="Docker Hub" src="https://img.shields.io/docker/v/evilsocket/nerve?logo=docker"></a>
-->

<a href="https://rust-reportcard.xuri.me/report/github.com/evilsocket/nerve"><img alt="Rust Report" src="https://rust-reportcard.xuri.me/badge/github.com/evilsocket/nerve"></a>
<a href="#"><img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/evilsocket/nerve/test.yml"></a>
<a href="https://github.com/evilsocket/nerve/blob/master/LICENSE.md"><img alt="Software License" src="https://img.shields.io/badge/license-GPL3-brightgreen.svg?style=flat-square"></a>
Expand Down

0 comments on commit 9561b01

Please sign in to comment.