-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.ubuntu
56 lines (46 loc) · 1.64 KB
/
Dockerfile.ubuntu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
##########################################
# Image Ubuntu with libgpiod
# C library and tools for interacting with
# the linux GPIO character device
# Site: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
##########################################
ARG IMAGE_VERSION="ubuntu:24.04"
# build
FROM $IMAGE_VERSION as build
ARG LIB_VERSION="2.1.2"
# Install
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends sudo
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y pkg-config
# Copy to image
COPY setup-libgpiod.sh /
RUN chmod +x /setup-libgpiod.sh \
&& /setup-libgpiod.sh --type source --path /usr/share/libgpiod --version ${LIB_VERSION} --artifact yes
# out
FROM scratch as artifact
COPY --from=build /out/* /
# result
FROM $IMAGE_VERSION as release
ARG LIB_VERSION="2.1.2"
# Label docker image
MAINTAINER DevDotNet.Org <[email protected]>
LABEL version="$LIB_VERSION"
LABEL maintainer="DevDotNet.Org <[email protected]>"
COPY --from=build /usr/share/libgpiod/artifact.zip /artifact.zip
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends unzip \
&& unzip -o /artifact.zip -d /usr/ \
&& rm /artifact.zip \
&& apt-get remove -y unzip \
#Cleaning
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/ \
&& rm -rf /var/log/* \
&& rm -rf /tmp/* /var/tmp/* \
&& rm -rf /usr/share/doc/ \
&& rm -rf /usr/share/man/ \
&& rm -rf /var/lib/apt/lists/*
CMD ["/usr/bin/gpioinfo", "-v"]