mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
testenv: Dockerfile: refactor, use caching pervasively (#190)
This commit is contained in:
parent
bd9f5bf9ee
commit
49fb9a6f92
@ -7,23 +7,24 @@ RUN echo 'Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch' > /etc
|
|||||||
&& pacman-key --init \
|
&& pacman-key --init \
|
||||||
&& pacman-key --populate archlinux
|
&& pacman-key --populate archlinux
|
||||||
|
|
||||||
RUN pacman --noconfirm --ask=4 -Syy \
|
RUN \
|
||||||
&& pacman --needed --noconfirm --ask=4 -S \
|
--mount=type=cache,id=kvmd-pacman-pkg,target=/var/cache/pacman/pkg \
|
||||||
|
--mount=type=cache,id=kvmd-pacman-db,target=/var/lib/pacman/sync \
|
||||||
|
PACMAN="pacman --noconfirm --ask=4 --needed" \
|
||||||
|
&& $PACMAN -Syy \
|
||||||
archlinux-keyring \
|
archlinux-keyring \
|
||||||
&& pacman --needed --noconfirm --ask=4 -S \
|
&& $PACMAN -S \
|
||||||
glibc \
|
glibc \
|
||||||
pacman \
|
pacman \
|
||||||
openssl \
|
openssl \
|
||||||
openssl-1.1 \
|
openssl-1.1 \
|
||||||
&& pacman-db-upgrade \
|
&& pacman-db-upgrade \
|
||||||
&& pacman --noconfirm --ask=4 -Syu \
|
&& $PACMAN -Syu \
|
||||||
&& pacman --needed --noconfirm --ask=4 -S \
|
|
||||||
p11-kit \
|
p11-kit \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
ca-certificates-mozilla \
|
ca-certificates-mozilla \
|
||||||
ca-certificates-utils \
|
ca-certificates-utils \
|
||||||
&& pacman -Syu --noconfirm --ask=4 \
|
&& $PACMAN -Syu \
|
||||||
&& pacman -S --needed --noconfirm --ask=4 \
|
|
||||||
base-devel \
|
base-devel \
|
||||||
autoconf-archive \
|
autoconf-archive \
|
||||||
help2man \
|
help2man \
|
||||||
@ -78,28 +79,35 @@ RUN pacman --noconfirm --ask=4 -Syy \
|
|||||||
eslint \
|
eslint \
|
||||||
npm \
|
npm \
|
||||||
shellcheck \
|
shellcheck \
|
||||||
&& (pacman -Sc --noconfirm || true) \
|
&& :
|
||||||
&& rm -rf /var/cache/pacman/pkg/*
|
|
||||||
|
|
||||||
COPY testenv/requirements.txt requirements.txt
|
COPY testenv/requirements.txt requirements.txt
|
||||||
RUN pip install --break-system-packages -r requirements.txt
|
RUN \
|
||||||
|
--mount=type=cache,id=kvmd-pip,target=/root/.cache/pip \
|
||||||
|
pip install --break-system-packages --root-user-action=ignore \
|
||||||
|
-r requirements.txt
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/57534295
|
# https://stackoverflow.com/questions/57534295
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
RUN npm install htmlhint -g \
|
RUN \
|
||||||
&& npm install pug \
|
--mount=type=cache,id=kvmd-npm,target=/root/.npm \
|
||||||
&& npm install pug-cli -g \
|
--mount=type=tmpfs,target=/tmp \
|
||||||
&& npm install @babel/eslint-parser -g
|
npm install -g \
|
||||||
|
htmlhint \
|
||||||
|
pug \
|
||||||
|
pug-cli \
|
||||||
|
@babel/eslint-parser
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
ARG USTREAMER_MIN_VERSION
|
ARG USTREAMER_MIN_VERSION
|
||||||
ENV USTREAMER_MIN_VERSION $USTREAMER_MIN_VERSION
|
ENV USTREAMER_MIN_VERSION $USTREAMER_MIN_VERSION
|
||||||
RUN echo $USTREAMER_MIN_VERSION
|
RUN echo $USTREAMER_MIN_VERSION
|
||||||
RUN git clone https://github.com/pikvm/ustreamer \
|
RUN \
|
||||||
|
--mount=type=tmpfs,target=/tmp \
|
||||||
|
cd /tmp \
|
||||||
|
&& git clone --depth=1 https://github.com/pikvm/ustreamer \
|
||||||
&& cd ustreamer \
|
&& cd ustreamer \
|
||||||
&& make WITH_PYTHON=1 PREFIX=/usr DESTDIR=/ install \
|
&& make WITH_PYTHON=1 PREFIX=/usr DESTDIR=/ install
|
||||||
&& cd - \
|
|
||||||
&& rm -rf ustreamer
|
|
||||||
|
|
||||||
RUN mkdir -p \
|
RUN mkdir -p \
|
||||||
/etc/kvmd/{nginx,vnc} \
|
/etc/kvmd/{nginx,vnc} \
|
||||||
@ -112,4 +120,4 @@ COPY testenv/fakes/sys /fake_sysfs/sys
|
|||||||
COPY testenv/fakes/proc /fake_procfs/proc
|
COPY testenv/fakes/proc /fake_procfs/proc
|
||||||
COPY testenv/fakes/etc /fake_etc/etc
|
COPY testenv/fakes/etc /fake_etc/etc
|
||||||
|
|
||||||
CMD /bin/bash
|
CMD ["/bin/bash"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user