-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.alpine
51 lines (42 loc) · 1.36 KB
/
Dockerfile.alpine
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
##########################################
# Image Alpine 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="alpine:3.20"
# build
FROM $IMAGE_VERSION as build
ARG LIB_VERSION="2.1.2"
# Install
RUN apk update && apk upgrade --available && apk add --no-cache --upgrade sudo bash
# 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 apk update \
&& apk upgrade --available \
&& apk add --no-cache --upgrade unzip \
&& unzip -o /artifact.zip -d /usr/ \
&& rm /artifact.zip \
&& apk del unzip \
#Cleaning
&& rm -rf /var/lib/{cache,log}/ \
&& rm -rf /var/lib/apt/lists/*.lz4 \
&& rm -rf /var/log/* \
&& rm -rf /tmp/* /var/tmp/* \
&& rm -rf /usr/share/doc/ \
&& rm -rf /usr/share/man/ \
&& rm -rf /var/cache/apk/*
CMD ["/usr/bin/gpioinfo", "-v"]