Linux/alpine:修订间差异
来自康健生活
创建页面,内容为“== start == == package == https://pkgs.alpinelinux.org/packages” |
|||
| (未显示同一用户的13个中间版本) | |||
| 第2行: | 第2行: | ||
== package == | == package == | ||
=== apk === | |||
安装指定版本的软件。{{shc|<syntaxhighlight lang="bash"> | |||
apk add packagename=1.1.1-r0 | |||
# | |||
apk add "packagename>1.1.1-r0"</syntaxhighlight>|$|/home/kangkk}} | |||
eq: | |||
{{shc|<syntaxhighlight lang="bash"> | |||
apk update && apk --no-cache add git openssh python2 bash nodejs=14.16.1-r1 npm</syntaxhighlight>|$|/home/kangkk}} | |||
在 drone 中配置,eq: | |||
{{Hc|.drone.yml|<pre> | |||
steps: | |||
- name: build-plugin-ps | |||
image: node:14.18.1-alpine | |||
environment: | |||
ELECTRON_MIRROR: http://npm.taobao.org/mirrors/electron/ | |||
commands: | |||
- apk update && apk --no-cache add git openssh python2 bash autoconf</pre>}} | |||
==== 指定 alpine 版本 ==== | |||
定 alpine 版本为 13.3 版本。 | |||
{{Hc|.drone.yml|<pre> | |||
--- | |||
# 更新插件和通知 | |||
kind: pipeline | |||
type: docker | |||
name: after | |||
steps: | |||
- name: build-plugin-ps | |||
image: alpine:3.13 | |||
environment: | |||
ELECTRON_MIRROR: http://npm.taobao.org/mirrors/electron/ | |||
commands: | |||
- apk update && apk --no-cache add git openssh nodejs=14.18.1-r0 npm python2 bash build-base mesa-dev gcc autoconf automake libtool zlib-dev nasm mesa libxi libpng-dev libjpeg jpeg-dev make | |||
- git clone -b ${DRONE_BRANCH} https://w.src.corp.qihoo.net/design/medici-photoshop.git && cd medici-photoshop | |||
- chmod +x ./ssh/pre_build.sh | |||
- sh ./ssh/pre_build.sh ${DRONE_BRANCH} | |||
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | |||
- name: build-plugin-sketch | |||
image: node:lts-alpine | |||
environment: | |||
ELECTRON_MIRROR: http://npm.taobao.org/mirrors/electron/ | |||
commands: | |||
- apk --no-cache add git openssh zip python3 py3-pip && pip3 install --upgrade pip && pip3 install awscli awscli-plugin-endpoint -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com && rm -rf /var/cache/apk/* | |||
- git clone -b ${DRONE_BRANCH} https://w.src.corp.qihoo.net/design/medici-sketch.git && cd medici-sketch | |||
- npm install | |||
- chmod +x ./build.sh | |||
- sh ./build.sh ${DRONE_BRANCH} | |||
- aws --version | |||
- sh ./post.sh NlIhNSmzMz70IFDdyrXU bLTyqmNntR5AP1rJKumChNAeuucrmuAyOenCfToB ${DRONE_BRANCH} | |||
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | |||
trigger: | |||
branch: | |||
- beta | |||
- audit | |||
- master | |||
event: | |||
- push | |||
depends_on: | |||
- frontend</pre>}} | |||
== 源 == | |||
镜像源地址:[https://mirrors.alpinelinux.org/ Official Alpine Linux mirrors]。 | |||
更换源。 | |||
{{Hc|dockerfile|<syntaxhighlight lang="dockerfile"> | |||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories</syntaxhighlight>}} | |||
或者。 | |||
{{Hc|dockerfile|<syntaxhighlight lang="dockerfile"> | |||
RUN echo http://mirrors.aliyun.com/alpine/v3.12/main > /etc/apk/repositories \ | |||
echo http://mirrors.aliyun.com/alpine/v3.12/community >> /etc/apk/repositories \ | |||
echo http://mirrors.aliyun.com/alpine/v3.12/releases >> /etc/apk/repositories</syntaxhighlight>}} | |||
== error == | |||
* <syntaxhighlight lang="javascript"> | |||
ERROR: http://mirrors.aliyun.com/alpine/v3.11/main: temporary error (try again later) | |||
WARNING: Ignoring http://mirrors.aliyun.com/alpine/v3.11/main: No such file or directory | |||
ERROR: http://mirrors.aliyun.com/alpine/v3.11/community: temporary error (try again later) | |||
WARNING: Ignoring http://mirrors.aliyun.com/alpine/v3.11/community: No such file or directory</syntaxhighlight> | |||
: 添加 <code>--network=host</code> | |||
: {{shc|<syntaxhighlight lang="bash"> | |||
sudo docker build -f ./deploy/DockerfileNginx -t test-qfonts-backend . --network=host | |||
</syntaxhighlight>|$|/home/kangkk}} | |||
* <syntaxhighlight lang="javascript"> | |||
ERROR: unable to select packages: | |||
nodejs-12.22.6-r0: | |||
breaks: world[nodejs=16.14.2-r0] | |||
The command '/bin/sh -c apk add nodejs=16.14.2-r0' returned a non-zero code: 1</syntaxhighlight> | |||
: Alpine Linux 没有保留旧的包,避免固定包版本,而使用存储库固定。也就是说需要更改 Alpine 版本。 | |||
== 参考 == | |||
https://pkgs.alpinelinux.org/packages | https://pkgs.alpinelinux.org/packages | ||