Skip to content

Commit

Permalink
Improve builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Mubelotix committed Jun 1, 2024
1 parent e0ff935 commit 5b71bd8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
target/debug
target/tmp
target/wasm32-unknown-unknown
target/wasm-bindgen
target/release/build
target/release/deps
target/release/examples
target/release/incremental
webui/dist
15 changes: 15 additions & 0 deletions .github/workflows/publish-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,24 @@ jobs:
contents: read
packages: write


steps:
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/publish-docker.yml') }}

- name: Checkout repository
uses: actions/checkout@v3

- name: Build with cargo
run: cargo build --release

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand All @@ -41,6 +55,7 @@ jobs:
with:
context: .
platforms: linux/amd64,linux/arm64
build-args: SKIP_BUILD=true
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
ARG SKIP_BUILD=false

# Build stage
FROM rust:1-slim-bookworm as build

RUN apt-get update && apt-get install -y pkg-config libssl-dev && apt-get clean

WORKDIR /usr/src/admarus
COPY . .

RUN cd daemon && \
cargo build --release && \
mv ../target/release/admarusd /usr/local/bin/admarusd && \
cd ../../ && \
ARG SKIP_BUILD
RUN if [ "$SKIP_BUILD" = "false" ]; then \
cargo build --release --package admarusd; \
fi

RUN cp target/release/admarusd /usr/local/bin/admarusd && \
cd .. && \
rm -rf admarus

# Final stage
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y libssl3 ca-certificates && apt-get clean
Expand Down

0 comments on commit 5b71bd8

Please sign in to comment.