commit 90680662fca3dd0bc62d69b64be6bc15126fada5 Author: hugogogo Date: Sat Aug 27 15:15:32 2022 +0200 initial commit + creating the architecture + some doc about volumes and bind mounts + added rule for iso in gitignore + understood a little more about dockerfile environment diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..edf39e5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,51 @@ +# These are some examples of commonly ignored file patterns. +# You should customize this list as applicable to your project. +# Learn more about .gitignore: +# https://www.atlassian.com/git/tutorials/saving-changes/gitignore + +# Node artifact files +node_modules/ +dist/ + +# Compiled Java class files +*.class + +# Compiled Python bytecode +*.py[cod] + +# Log files +*.log + +# Package files +*.jar + +# Maven +target/ +dist/ + +# JetBrains IDE +.idea/ + +# Unit test reports +TEST*.xml + +# Generated by MacOS +.DS_Store + +# Generated by Windows +Thumbs.db + +# Applications +*.app +*.exe +*.war + +# Large media files +*.mp4 +*.tiff +*.avi +*.flv +*.mov +*.wmv +*.iso + diff --git a/README.md b/README.md new file mode 100644 index 0000000..621310f --- /dev/null +++ b/README.md @@ -0,0 +1,109 @@ + +18 :e open a new file in new buffer +19 :b roll between opened files +20 :b auto complete with names of oppened buffers +21 :set hidden add that to be able to cancel changes +22 :ls list buffer oppened +23 :x bw delete buffer number x, even if it's a directory +24 :bd delete buffer actual buffer +25 :bp go to previous buffer +26 :bn go to next buffer +27 :b# switch to last edited buffer +28 :e C-d print the list of files in current directory +29 :e C-d auto complete with a mathing name of files in current directory +30 :explore / :ex navigate through directory, rename, and plus + +# inception + +This README would normally document whatever steps are necessary to get your application up and running. + +--- +## questions + +- ? what means mounted in "a file or directory on the host machine is mounted into a container" ? +- ? why the volumes cannot be modify outside docker ? + +--- +## Dockerfile basics + +- the container posess its own filesystem +- we need to copy the files it uses inside this filesystem +- we can do that with COPY + +**working** +``` +FROM scratch +WORKDIR / +COPY hello / +CMD [ "/hello" ] +``` + +**working, when WORKDIR is absent, it's default is set to "/"** +``` +FROM scratch +COPY hello / +CMD [ "/hello" ] +``` + +**not working, when CMD execute in shell form, instead of exec form []** +``` +FROM scratch +COPY hello / +CMD /hello +``` + +**not working, because c executable need library ** +``` +FROM scratch +COPY hello_c / +CMD [ "/hello_c" ] +``` + +**not working, when executable is copied to ".", because WORKDIR value is not "." but "/" since we gave it a relativ path so it was build in top of the implicit absolut path "/"** +``` +FROM scratch +WORKDIR . +COPY hello . +CMD [ "hello" ] +``` + +**not working, when WORKDIR is set to the present directory and executable is not copied, because the workdir is not the present directory but a directory in the file system of docker : executable need to be copied there to function** +``` +FROM scratch +WORKDIR /home/simplonco/Desktop/42/14_inception/inception/srcs/requirements/mariadb +CMD [ "hello" ] +``` + +**working, because "hello" is copied to "/" and execute from "/"** +``` +FROM scratch +WORKDIR . +COPY hello / +CMD [ "/hello" ] +``` + +--- +## ressources + +- [how to install docker engine](https://docs.docker.com/engine/install/ubuntu/) +- [download alpine linux](https://alpinelinux.org/downloads/) +- [dockerhub alpine image](https://hub.docker.com/_/alpine) +- [docker glossaire](https://docs.docker.com/glossary/) +- [syntax of Dockerfile](https://docs.docker.com/engine/reference/builder/) +- [determine the parent image](https://forums.docker.com/t/determine-the-parent-image/48611) +- [docker image from scratch](https://codeburst.io/docker-from-scratch-2a84552470c8) + +#### volumes vs bind mounts + +* [docker doc: use volumes](https://docs.docker.com/storage/volumes/) +* [docker doc: use bind mounts](https://docs.docker.com/storage/bind-mounts/) +* [comparison volume vs bind mounts](https://devopscook.com/docker-volumes-vs-bind-mounts/) +* [fundamentals use of volumes and bind mounts](https://medium.com/dlt-labs-publication/bind-mounts-volumes-in-docker-81523303cbb4) +* [how volumes and bind mounts are really differents](https://serverfault.com/questions/996785/docker-volumes-vs-mount-binds-what-are-the-use-cases) +- bind mounts are normal files anywhere on the computer, that docker container can access with absolut path and modify. They can also be modified without docker, since they are juste files +- volumes are only modifiable by docker, they don't need an absolut path, and they are not dependent of host architecture + +#### tips + +[run without sudo on linux](https://docs.docker.com/engine/install/linux-postinstall/) + diff --git a/docs/inception_en.subject.pdf b/docs/inception_en.subject.pdf new file mode 100644 index 0000000..996e8b2 Binary files /dev/null and b/docs/inception_en.subject.pdf differ diff --git a/docs/inception_fr.subject.pdf b/docs/inception_fr.subject.pdf new file mode 100644 index 0000000..f613f57 Binary files /dev/null and b/docs/inception_fr.subject.pdf differ diff --git a/srcs/.env b/srcs/.env new file mode 100644 index 0000000..4789e9f --- /dev/null +++ b/srcs/.env @@ -0,0 +1,8 @@ +DOMAIN_NAME=wil.42.fr +# certificates +CERTS_=./XXXXXXXXXXXX +# MYSQL SETUP +MYSQL_ROOT_PASSWORD=XXXXXXXXXXXX +MYSQL_USER=XXXXXXXXXXXX +MYSQL_PASSWORD=XXXXXXXXXXXX +[...] diff --git a/srcs/docker-compose.yml b/srcs/docker-compose.yml new file mode 100644 index 0000000..e69de29 diff --git a/srcs/requirements/mariadb/.dockerignore b/srcs/requirements/mariadb/.dockerignore new file mode 100644 index 0000000..e69de29 diff --git a/srcs/requirements/mariadb/Dockerfile b/srcs/requirements/mariadb/Dockerfile new file mode 100644 index 0000000..21e61ee --- /dev/null +++ b/srcs/requirements/mariadb/Dockerfile @@ -0,0 +1,10 @@ + +# build this image from parent image alpine:3.16.1 +# available there : https://hub.docker.com/_/alpine +FROM alpine:3.16.1 +WORKDIR /mariadb +#ENV PORT 80 + + + + diff --git a/srcs/requirements/nginx/.dockerignore b/srcs/requirements/nginx/.dockerignore new file mode 100644 index 0000000..e69de29 diff --git a/srcs/requirements/nginx/Dockerfile b/srcs/requirements/nginx/Dockerfile new file mode 100644 index 0000000..e69de29