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

feat: part 2 of ex4 done (lab8)

parent 2b825811
Branches
No related tags found
No related merge requests found
...@@ -285,19 +285,19 @@ alienwave_multistage 1.0 1c7f0a242c2c 4 minutes ago 12MB ...@@ -285,19 +285,19 @@ alienwave_multistage 1.0 1c7f0a242c2c 4 minutes ago 12MB
#### Dockerfile #### Dockerfile
```bash ```bash
FROM ubuntu:22.04 as BUILDER FROM ubuntu:22.04
RUN apt update -y && apt install -y golang ca-certificates RUN apt update -y && apt install -y golang ca-certificates && go install github.com/alfg/asciicat@latest
RUN go install github.com/alfg/asciicat@latest
WORKDIR /root
FROM alpine:3.20 ENV PATH="${PATH}:/root/go/bin"
WORKDIR /home/Pictures
RUN apk update
COPY --from=builder /root/go/bin/asciicat /usr/bin
COPY . . COPY . .
ENTRYPOINT ["usr/bin/asciicat"] ENTRYPOINT ["asciicat"]
``` ```
#### Fabrication de l'image #### Fabrication de l'image
...@@ -309,7 +309,7 @@ docker buildx build . -t asciicat:1.0 -f Dockerfile1 ...@@ -309,7 +309,7 @@ docker buildx build . -t asciicat:1.0 -f Dockerfile1
#### Utilisation #### Utilisation
```bash ```bash
docker run --rm asciicat:1.0 -i gopher.png docker run --rm asciicat:1.0 -i tux.png
``` ```
- Quelle est la taille de l'image générée ? - Quelle est la taille de l'image générée ?
...@@ -331,5 +331,35 @@ Donc la largeur par défaut de l'image est 80 ...@@ -331,5 +331,35 @@ Donc la largeur par défaut de l'image est 80
- Quelle est la ligne de commande à exécuter pour obtenir une largeur de 40 - Quelle est la ligne de commande à exécuter pour obtenir une largeur de 40
```bash ```bash
docker run --rm asciicat:1.0 -i gopher.png -w 40 docker run --rm asciicat:1.0 -i cat.png -w 40
``` ```
### Partie 2
#### Dockerfile
```bash
FROM ubuntu:22.04 as BUILDER
RUN apt update -y && apt install -y golang ca-certificates
RUN go install github.com/alfg/asciicat@latest
FROM alpine:3.20
RUN apk update
COPY --from=builder /root/go/bin/asciicat /usr/bin
COPY . .
ENTRYPOINT ["usr/bin/asciicat"]
```
#### Affichez la différence de taille entre l'image initiale et la _multi-stage build_
```bash
REPOSITORY TAG IMAGE ID CREATED SIZE
asciicat_multistage 1.0 a10aafdcc5c2 12 seconds ago 12.8MB
asciicat 1.0 5f22c52d66b2 7 minutes ago 890MB
```
- Le facteur de taille gagnée est de $\sim 69$ (noice) fois.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment