Skip to content

Commit 0b57533

Browse files
committed
feat: added basic Dockerfile for compiling from scratch
1 parent 5df6e1e commit 0b57533

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
!include
66
!cmake/
77
!docker/startup.sh
8+
!share/
9+
10+
# Rust bindings
11+
!bindings/rust/

bindings/rust/.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

docker/Dockerfile

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
ARG BASE_IMAGE=ghcr.io/games-on-whales/base:edge
2+
3+
####################################
4+
FROM $BASE_IMAGE AS build-libinputtino
5+
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
RUN apt-get update -y && \
9+
apt-get install -y --no-install-recommends \
10+
ca-certificates \
11+
ccache \
12+
ninja-build \
13+
cmake \
14+
clang \
15+
pkg-config \
16+
git \
17+
libevdev-dev \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
21+
COPY . /inputtino/
22+
WORKDIR /inputtino
23+
24+
ENV CCACHE_DIR=/cache/ccache
25+
ENV CMAKE_BUILD_DIR=/cache/cmake-build
26+
RUN --mount=type=cache,target=/cache/ccache \
27+
cmake -B$CMAKE_BUILD_DIR \
28+
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
29+
-DCMAKE_BUILD_TYPE=Release \
30+
-DBUILD_TESTING=OFF \
31+
-DBUILD_C_BINDINGS=ON \
32+
-DLIBINPUTTINO_INSTALL=ON \
33+
-DBUILD_SHARED_LIBS=ON \
34+
-G Ninja && \
35+
ninja -C $CMAKE_BUILD_DIR install
36+
37+
####################################
38+
FROM $BASE_IMAGE AS base-libinputtino
39+
40+
RUN apt-get update -y && \
41+
apt-get install -y --no-install-recommends libevdev2 \
42+
&& rm -rf /var/lib/apt/lists/*
43+
44+
COPY --from=build-libinputtino /usr/include/inputtino /usr/include/inputtino
45+
COPY --from=build-libinputtino /usr/share/pkgconfig/libinputtino.pc /usr/share/pkgconfig/libinputtino.pc
46+
COPY --from=build-libinputtino /usr/lib/x86_64-linux-gnu/liblibinputtino* /usr/lib/x86_64-linux-gnu/
47+
48+
####################################
49+
FROM base-libinputtino AS build-rust-bindings
50+
51+
ENV DEBIAN_FRONTEND=noninteractive
52+
53+
RUN apt-get update -y && \
54+
apt-get install -y --no-install-recommends \
55+
ca-certificates \
56+
pkg-config \
57+
build-essential \
58+
clang \
59+
curl \
60+
&& curl https://sh.rustup.rs -sSf | bash -s -- -y \
61+
&& rm -rf /var/lib/apt/lists/*
62+
63+
ENV PATH="${HOME}/.cargo/bin:${PATH}"
64+
65+
COPY ./bindings/rust /inputtino-rust
66+
WORKDIR /inputtino-rust
67+
68+
69+
RUN cargo build --release
70+

0 commit comments

Comments
 (0)