-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (56 loc) · 1.79 KB
/
Copy pathDockerfile
File metadata and controls
71 lines (56 loc) · 1.79 KB
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
ARG BASE_IMAGE=ghcr.io/loong64/loongnix:25
FROM ${BASE_IMAGE} AS base
ARG TARGETARCH
ARG DEPENDENCIES=" \
ccache \
curl \
devscripts \
equivs \
gcc \
git \
g++ \
libc6 \
libdrm-dev \
libglib2.0-dev \
libkeyutils-dev \
libssl-dev \
lsb-release \
make \
ninja-build \
pkg-config \
python3-setuptools \
xz-utils"
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update \
&& apt-get install -y systemd-standalone-sysusers \
&& apt-get install -y ${DEPENDENCIES}
ARG VERSION
ARG WORKDIR=/opt/lat
RUN set -ex \
&& git clone --depth=1 --recursive -b ${VERSION} https://github.com/lat-opensource/lat ${WORKDIR}
ENV USE_CCACHE=1
WORKDIR ${WORKDIR}
FROM base AS build-binary
ARG TARGETARCH
RUN --mount=type=cache,target=/root/.cache/ccache \
set -x \
&& ./latxbuild/build-release.sh \
&& mkdir -p dist \
&& mv lat-${VERSION}-*.tar.xz dist/lat-${VERSION}-linux-${TARGETARCH}.tar.xz
FROM base AS build-deb
ARG TARGETARCH
COPY debian debian
RUN --mount=type=bind,source=scripts/gen-deb-changelog.sh,target=/usr/local/bin/gen-deb-changelog \
--mount=type=cache,target=/root/.cache/ccache \
gen-deb-changelog \
&& dpkg-buildpackage -b -rfakeroot -us -uc \
&& cd .. \
&& rm -rf lat
FROM ghcr.io/loong64/debian:trixie-slim
ARG TARGETARCH
WORKDIR /opt/dist
COPY --from=build-deb /opt/ /opt/dist/
COPY --from=build-binary /opt/lat/dist/ /opt/dist/
VOLUME /dist
CMD cp -rf /opt/dist/* /dist/