gpt4 book ai didi

wordpress - 如何在 Dockerfile 中下载和解压

转载 作者:行者123 更新时间:2023-12-02 17:22:19 25 4
gpt4 key购买 nike

所以,我有,它可以工作,但我想更改立即下载文件并解压缩的方式:

Dockerfile
FROM wordpress:fpm

# Copying themes from local
COPY ./wordpress/ /var/www/html/wp-content/themes/wordpress/
RUN chmod -R 777 /var/www/html/

如何立即从站点下载文件并将其解压缩到适当的文件夹?
docker-compose.yml
wordpress:
build: .
links:
- db:mysql
nginx:
image: raulr/nginx-wordpress
links:
- wordpress
ports:
- "8080:80"
volumes_from:
- wordpress
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: qwerty

我试过:
#install unzip and wget
RUN \
apt-get update && \
apt-get install unzip wget -y && \
rm -rf /var/lib/apt/lists/*

RUN wget -O /var/www/html/type.zip http://wp-templates.ru/download/2405 \
&& unzip '/var/www/html/type.zip' -d /var/www/html/wp-content/themes/ && rm
/var/www/html/type.zip || true;

最佳答案

Dockerfile 具有用于复制和提取的“ native 命令”.tar.gz文件。

因此,您可以将存档类型从 .zip 更改为 .tar.gz(也许在 future 的版本中也会支持 zip,我不确定)并使用 ADD而不是 COPY .

Read more about ADD

关于wordpress - 如何在 Dockerfile 中下载和解压,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53840831/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com