How to download and unzip in Dockerfile
25,178
Dockerfile has "native command" for copying and extracting .tar.gz
files.
So you can change archive type from .zip to .tar.gz (maybe in future versions zip also will be supported, I'm not sure) and use ADD
instead of COPY
.
Author by
DromiX
Updated on July 09, 2022Comments
-
DromiX almost 2 years
So, I have, it works, but I want to change the way to immediately download the file and unpack it:
Dockerfile FROM wordpress:fpm # Copying themes from local COPY ./wordpress/ /var/www/html/wp-content/themes/wordpress/ RUN chmod -R 777 /var/www/html/
How can I immediately download the file from the site and unzip it to the appropriate folder?
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
I tried:
#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;