Skip to content

Commit 157854c

Browse files
committed
Add the assignment to intgrate a build arg
[refs #c2f282de0b87]
1 parent 15e198c commit 157854c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

nginx/assignment5.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Add a build argument to the nginx image
2+
* Define a build argument to define which package to install
3+
* `nginx-light`
4+
* `nginx-full`
5+
* `nginx-extras`
6+
* Value should either be `light`, `full` or `extras`
7+
* Set the default to `full`
8+
* Make the installed package available in the environment variable `NGINX_PKG`
9+
* For example `nginx-full`
10+
* Try building and testing the image
11+
* Add a Docker Compose file
12+
* Add a service for each variant
13+
* Set the build arguments
14+
* Tag the image with the package type installed
15+
* jfahrer/nginx:stretch-light
16+
* jfahrer/nginx:stretch-full
17+
* jfahrer/nginx:stretch-extras
18+
* Build and push all the images
19+
20+
## The Dockerfile
21+
```
22+
FROM debian:buster-slim
23+
24+
RUN apt-get update \
25+
&& apt-get install -y nginx \
26+
&& rm -rf /var/lib/apt/lists/* \
27+
&& rm /var/log/nginx/access.log \
28+
&& rm /var/log/nginx/error.log \
29+
&& ln -s /dev/stdout /var/log/nginx/access.log \
30+
&& ln -s /dev/stderr /var/log/nginx/error.log
31+
32+
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]
33+
```

0 commit comments

Comments
 (0)