Skip to content

Commit 3809509

Browse files
ci: add docker build (#709)
1 parent be235e7 commit 3809509

File tree

3 files changed

+30
-62
lines changed

3 files changed

+30
-62
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/target/
2+
Dockerfile
3+
.git/
4+
.gitignore
5+
.env

.github/workflows/build.yml

Lines changed: 19 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ env:
1313
RUST_TOOLCHAIN: nightly-2024-11-29
1414

1515
jobs:
16+
docker:
17+
runs-on: ubuntu-latest
18+
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Build Docker image
27+
uses: docker/build-push-action@v5
28+
with:
29+
context: .
30+
push: false
31+
load: true
32+
cache-from: type=gha
33+
cache-to: type=gha,mode=max
34+
1635
machete:
1736
runs-on: ubuntu-latest
1837

@@ -29,25 +48,6 @@ jobs:
2948
run: |
3049
cargo machete
3150
32-
# test:
33-
# runs-on: ubuntu-latest
34-
#
35-
# steps:
36-
# - name: Checkout repository
37-
# uses: actions/checkout@v4
38-
#
39-
# - uses: actions-rust-lang/setup-rust-toolchain@v1
40-
# with:
41-
# toolchain: ${{ env.RUST_TOOLCHAIN }}
42-
#
43-
# - uses: Swatinem/rust-cache@v2
44-
# with:
45-
# cache-on-failure: true
46-
#
47-
# - name: Run cargo test
48-
# run: |
49-
# cargo test --workspace --all-features
50-
5151
fmt:
5252
runs-on: ubuntu-latest
5353

@@ -64,25 +64,6 @@ jobs:
6464
run: |
6565
cargo fmt --all -- --check
6666
67-
# docs:
68-
# runs-on: ubuntu-latest
69-
#
70-
# steps:
71-
# - name: Checkout repository
72-
# uses: actions/checkout@v4
73-
#
74-
# - uses: actions-rust-lang/setup-rust-toolchain@v1
75-
# with:
76-
# toolchain: ${{ env.RUST_TOOLCHAIN }}
77-
#
78-
# - uses: Swatinem/rust-cache@v2
79-
# with:
80-
# cache-on-failure: true
81-
# - name: Run cargo doc
82-
# run: |
83-
# cargo doc --workspace --no-deps --all-features
84-
# env:
85-
# RUSTDOCFLAGS: -D warnings
8667
8768
clippy:
8869
runs-on: ubuntu-latest
@@ -100,24 +81,3 @@ jobs:
10081

10182
- name: Clippy check
10283
run: cargo clippy --workspace --benches --tests --examples --all-features -- -D warnings
103-
104-
# check:
105-
# strategy:
106-
# matrix:
107-
# os: [ubuntu-latest, windows-latest, macos-latest]
108-
# runs-on: ${{ matrix.os }}
109-
# steps:
110-
# - name: Checkout repository
111-
# uses: actions/checkout@v4
112-
#
113-
# - name: Setup Rust toolchain
114-
# uses: actions-rust-lang/setup-rust-toolchain@v1
115-
# with:
116-
# toolchain: ${{ env.RUST_TOOLCHAIN }}
117-
#
118-
# - uses: Swatinem/rust-cache@v2
119-
# with:
120-
# cache-on-failure: true
121-
#
122-
# - name: Cargo check
123-
# run: cargo check --workspace --all-features

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ FROM ubuntu:22.04 AS packages
1111
ENV DEBIAN_FRONTEND=noninteractive
1212

1313
# Install essential build packages
14+
FROM ubuntu:22.04 AS packages
15+
ENV DEBIAN_FRONTEND=noninteractive
1416
RUN apt-get update && \
1517
apt-get install -y \
1618
curl \
@@ -21,6 +23,9 @@ RUN apt-get update && \
2123
perl \
2224
gcc \
2325
linux-headers-generic \
26+
libclang1 \
27+
llvm-dev \
28+
libclang-dev \
2429
&& rm -rf /var/lib/apt/lists/*
2530

2631
# Base builder stage with Rust installation
@@ -35,9 +40,7 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST_NIGH
3540
$CARGO_HOME/bin/rustc --version
3641
ENV PATH="${CARGO_HOME}/bin:${PATH}"
3742
WORKDIR /app
38-
COPY Cargo.toml Cargo.lock ./
39-
COPY crates/ ./crates
40-
COPY events ./events
43+
COPY . .
4144

4245
RUN --mount=type=cache,target=${CARGO_HOME}/registry \
4346
--mount=type=cache,target=${CARGO_HOME}/git \

0 commit comments

Comments
 (0)