改用两阶段构建
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
zhbaor 2023-12-09 22:50:23 +08:00
parent b6da5e124d
commit c3daaace08
2 changed files with 28 additions and 16 deletions

View file

@ -1,22 +1,13 @@
steps: steps:
build: build:
image: almalinux:9 image: docker
commands: commands:
- dnf -y install dnf-plugin-config-manager - docker build . --rm -t git.zhaozuohong.vip/zhao/node-pandoc
- dnf config-manager --set-enabled crb - docker login -u $REGISTRY_USERNAME -p $REGISTRY_PASSWORD git.zhaozuohong.vip
- dnf -y install epel-release buildah - docker push git.zhaozuohong.vip/zhao/node-pandoc
- echo 'unqualified-search-registries = ["docker.io"]' > /etc/containers/registries.conf - docker rmi git.zhaozuohong.vip/zhao/node-pandoc
- export microcontainer=$(buildah from almalinux/9-micro) volumes:
- export micromount=$(buildah mount $microcontainer) - /var/run/docker.sock:/var/run/docker.sock
- dnf install --installroot $micromount --releasever 9 --setopt install_weak_deps=false --nodocs -y nodejs git-tools
- dnf clean all --installroot $micromount
- wget https://github.com/jgm/pandoc/releases/download/3.1.9/pandoc-3.1.9-linux-amd64.tar.gz
- tar xvf pandoc-3.1.9-linux-amd64.tar.gz
- cp pandoc-3.1.9/bin/pandoc $micromount/usr/bin/
- buildah unmount $microcontainer
- buildah commit $microcontainer git.zhaozuohong.vip/zhao/node-pandoc
- buildah login -u $REGISTRY_USERNAME -p $REGISTRY_PASSWORD git.zhaozuohong.vip
- buildah push git.zhaozuohong.vip/zhao/node-pandoc
secrets: secrets:
- registry_username - registry_username
- registry_password - registry_password

21
Dockerfile Normal file
View file

@ -0,0 +1,21 @@
FROM almalinux:9 as installer
RUN dnf -y install dnf-plugin-config-manager \
&& dnf config-manager --set-enabled crb \
&& dnf -y install epel-release
RUN dnf install \
--installroot /fakeroot \
--releasever 9 \
--setopt install_weak_deps=false \
--nodocs -y \
nodejs npm git-tools \
&& dnf clean all --installroot /fakeroot
RUN curl -L -o pandoc-3.1.9.tar.gz https://github.com/jgm/pandoc/releases/download/3.1.9/pandoc-3.1.9-linux-amd64.tar.gz \
&& tar -xvf pandoc-3.1.9.tar.gz \
&& cp pandoc-3.1.9/bin/pandoc /fakeroot/usr/local/bin/pandoc
FROM scratch
COPY --from=installer /fakeroot /
RUN npm install -g pnpm \
&& npm cache clean --force