目前正在执行一项任务,我必须调整现有的 dockerfile 来为 Python 3.12.2 创建新的 .tar.gz ,坦率地说,我已经束手无策了。 这是正在使用的脚本:
# The same base image as the jenkins agents
FROM openjdk:17-jdk-bullseye
# install tools we need
WORKDIR /package-install
ADD zstd_*_amd64.deb zstd.deb
RUN dpkg -i zstd.deb
# insert the input packages
WORKDIR /input
ADD cpython-*-x86_64-unknown-linux-gnu-pgo-*.tar.zst python.tar.zst
# re-compress the tar archive
WORKDIR /build
RUN unzstd /input/python.tar.zst -o ./python.tar
RUN gzip -k ./python.tar
# prepare the output file
RUN cp ./python.tar.gz /python.tar.gz
RUN chmod a=rw /python.tar.gz
# declare the export
VOLUME /export
WORKDIR /
# this will be executed when the container starts
CMD [ "cp", "-va", "/python.tar.gz", "/export/" ]
脚本在 unzstd 命令处失败,并告诉我它无法执行该任务,因为据称 python.tar.zst 是一个目录。
到目前为止我发现没有任何东西可以帮助我解决这个问题。如果您有任何想法导致此问题以及如何解决此问题,我将很高兴您的意见。
致以诚挚的问候 帕斯卡
其他信息:cpython-3.12.2+20240224-x86_64-unknown-linux-gnu-pgo-full.tar.zst是有问题的tar.zst。
在了解这一点后,我用谷歌搜索了一下,发现可以在命令中添加 -r 来解压缩 .tar.zst 中的每个文件,但这会产生以下错误:
The command '/bin/sh -c unzstd -r /input/python.tar.zst/ -o ./python.tar' returned a non-zero code: 1
问题在于
/bin/sh
对输入的解析。
比较:
$ /bin/sh -c unzstd a.out.zst -o whut
Incorrect parameters
Usage :
unzstd [args] [FILE(s)] [-o file]
FILE : a filename
with no FILE, or when FILE is - , read standard input
Arguments :
-# : # compression level (1-19, default: 3)
-d : decompression
-D file: use `file` as Dictionary
-o file: result stored into `file` (only if 1 input file)
-f : overwrite output without prompting and (de)compress links
--rm : remove source file(s) after successful de/compression
-k : preserve source file(s) (default)
-h/-H : display help/long help and exit
$ /bin/sh -c "unzstd a.out.zst -o whut"
a.out.zst : 16696 bytes