Skip to content
Snippets Groups Projects
Verified Commit 1126b3e7 authored by iliya.saroukha's avatar iliya.saroukha :first_quarter_moon:
Browse files

feat: ex2 done (lab8)

parent 76a7fcb0
No related branches found
No related tags found
No related merge requests found
Pipeline #32465 passed
...@@ -166,3 +166,59 @@ de l'image en étant `root` ne change rien quant aux attributs de l'image et ...@@ -166,3 +166,59 @@ de l'image en étant `root` ne change rien quant aux attributs de l'image et
le comportement du container instancié à partir de celle-ci. le comportement du container instancié à partir de celle-ci.
> prolly, bs ngl > prolly, bs ngl
## Exercice 2
### Contenu du `Dockerfile`
```bash
FROM archlinux:base-devel-20240101.0.204074
RUN pacman -Sy && pacman -S imagemagick --noconfirm
WORKDIR /data
ENTRYPOINT ["mogrify"]
CMD ["-help"]
```
### Commande permetant la fabrication de l'image à partir du Dockerfile
```bash
docker buildx build . -t imgconvert:1.0 -f Dockerfile.convert
```
### Script `mogrifydock.sh` permettant l'utilisation de l'image
```bash
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
docker run --rm \
imgconvert:1.0
exit 0
fi
if [ $# -ne 2 ]; then
echo "Usage: $0 \"<new_format>\" \"<images_to_convert>\""
exit 1
fi
format=$1
images=$2
docker run --rm \
--volume "$(pwd):/data" \
--user $(id -u):$(id -g) \
imgconvert:1.0 -format $format $images
```
### Exemple d'utilisation
Afin de pouvoir convertir toutes les photos `.jpg` du répertoire courant dont
le nom débute par la lettre "a", il est nécessaire d'exécuter le script
`mogrifydock.sh` de la manière suivante :
```bash
./mogrifydock.sh "png" "a*.jpg"
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment