Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
report
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ISC2
virtu
report
Commits
241f0fcf
Verified
Commit
241f0fcf
authored
11 months ago
by
iliya.saroukha
Browse files
Options
Downloads
Patches
Plain Diff
feat: part 2 of ex4 done (lab8)
parent
2b825811
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#32472
passed
11 months ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
content/08_dockerfiles.md
+39
-9
39 additions, 9 deletions
content/08_dockerfiles.md
with
39 additions
and
9 deletions
content/08_dockerfiles.md
+
39
−
9
View file @
241f0fcf
...
...
@@ -285,19 +285,19 @@ alienwave_multistage 1.0 1c7f0a242c2c 4 minutes ago 12MB
#### Dockerfile
```
bash
FROM ubuntu:22.04
as BUILDER
FROM ubuntu:22.04
RUN apt update
-y
&&
apt
install
-y
golang ca-certificates
RUN go
install
github.com/alfg/asciicat@latest
RUN apt update
-y
&&
apt
install
-y
golang ca-certificates
&&
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
.
.
ENTRYPOINT
[
"
usr/bin/
asciicat"
]
ENTRYPOINT
[
"asciicat"
]
```
#### Fabrication de l'image
...
...
@@ -309,7 +309,7 @@ docker buildx build . -t asciicat:1.0 -f Dockerfile1
#### Utilisation
```
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 ?
...
...
@@ -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
```
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 $
\s
im 69$ (noice) fois.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment