-
Notifications
You must be signed in to change notification settings - Fork 0
/
Containerfile
101 lines (84 loc) · 2.93 KB
/
Containerfile
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
ARG ALPINE_VERSION=edge
# versions must correspond with APKBUILD
ARG NEATVNC_VERSION="0.8.1-r0"
ARG WAYVNC_VERSION="0.8.0-r0"
FROM alpine:${ALPINE_VERSION}
LABEL maintainer="Björn Busse <[email protected]>"
LABEL org.opencontainers.image.source=https://github.com/bbusse/swayvnc-build
ARG TARGETARCH
ARG NEATVNC_VERSION
# Tested with: x86_64 / aarch64
ENV _APKBUILD="https://git.alpinelinux.org/aports/plain/community/neatvnc/APKBUILD" \
PKG_NEATVNC="neatvnc-${NEATVNC_VERSION}.apk" \
PKG_NEATVNC_DEV="neatvnc-dev-${NEATVNC_VERSION}.apk" \
USER="build"
# Add build requirements
RUN echo $'http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories \
# Add signing keys
&& apk add -X https://nl.alpinelinux.org/alpine/edge/main -u alpine-keys --allow-untrusted \
&& apk update \
&& apk upgrade \
&& apk add alpine-sdk curl gnutls-dev
# Add build user
RUN addgroup -S $USER && adduser -D $USER -G $USER -G abuild \
&& chown -R $USER /var/cache/distfiles
# Build
USER $USER
WORKDIR /home/$USER
RUN curl -LO $_APKBUILD \
&& abuild-keygen -a -n
USER root
RUN cp /home/$USER/.abuild/*.rsa.pub /etc/apk/keys/
USER $USER
RUN abuild checksum \
&& abuild -r \
&& ls packages/home/$(uname -m)/ \
&& cp /home/$USER/packages/home/$(uname -m)/$PKG_NEATVNC_DEV . \
&& cp /home/$USER/packages/home/$(uname -m)/$PKG_NEATVNC .
FROM alpine:${ALPINE_VERSION} AS builder_1
ARG ALPINE_VERSION
ARG NEATVNC_VERSION
ENV _APKBUILD="https://git.alpinelinux.org/aports/plain/community/wayvnc/APKBUILD" \
PKG_NEATVNC="neatvnc-${NEATVNC_VERSION}.apk" \
PKG_NEATVNC_DEV="neatvnc-dev-${NEATVNC_VERSION}.apk" \
USER="build"
# Add build requirements
RUN echo $'http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories \
# Add signing keys
&& apk add -X https://nl.alpinelinux.org/alpine/edge/main -u alpine-keys --allow-untrusted \
&& apk update \
&& apk add alpine-sdk curl
# Add build user
RUN addgroup -S $USER && adduser -D $USER -G $USER -G abuild \
&& chown -R $USER /var/cache/distfiles
# Copy
USER $USER
WORKDIR /home/$USER
COPY --from=0 /etc/apk/keys /etc/apk/keys
COPY --from=0 /home/$USER/$PKG_NEATVNC .
COPY --from=0 /home/$USER/$PKG_NEATVNC_DEV .
USER root
# Install copied dependencies
RUN apk update - allow-untrusted && \
apk add $PKG_NEATVNC $PKG_NEATVNC_DEV
ARG WAYVNC_VERSION
ENV PKG_WAYVNC="wayvnc-${WAYVNC_VERSION}.apk"
# Build
USER $USER
WORKDIR /home/$USER
RUN curl -LO $_APKBUILD \
# Remove version.patch from checksum list, we do
# not have it
&& awk '!/version.patch/' APKBUILD > APKBUILD_ \
&& rm APKBUILD \
&& mv APKBUILD_ APKBUILD \
&& abuild-keygen -a -n
USER root
RUN cp /home/$USER/.abuild/*.rsa.pub /etc/apk/keys/
USER $USER
RUN abuild checksum \
&& abuild -r \
&& ls packages/home/$(uname -m)/ \
&& cp /home/$USER/packages/home/$(uname -m)/$PKG_WAYVNC .
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]