Skip to content

This project is here to store my sample of a Dockerfile. I pref using a sample like this i'll never forget anything.

Notifications You must be signed in to change notification settings

gabyfulchic/complete-dockerfile-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

An example of complete dockerfile

Docker release

This project is here to store my default complete Dockerfile.
I pref using a sample to never forget anything and to curl
the file everytime I need to begin a Dockerfile.
There is also here a Dockerfile already ok to deploy flask apps.

Use Dockerfile

  • Get the example
curl https://raw.githubusercontent.com/gabyfulchic/complete-dockerfile-example/master/Dockerfile -O
wget https://raw.githubusercontent.com/gabyfulchic/complete-dockerfile-example/master/Dockerfile  
  • Dev your image
vim Dockerfile
  • Build your image
docker build . -t foo:v0.0.1
  • You can check it here
docker images | grep foo
  • Run a container using your image
docker run -it --rm -v /file/you/want/to/copy:/tmp/yourfile foo:v0.0.1 sh

Integrate Dockerfile to your production projects

You will maybe host the Dockerfile on your git repository to be close to your app,
and you will need to pass tests when you push a new release of your Dockerfile.
You will avoid human errors & therefore make your production cycle more faster.

You could use gitlab-ci (or Jenkins, circle-ci, travis-ci ...), to make a runner
build your image, send it to a personal repository (Harbor, Nexus ...) and then try
to run a docker container. Then your runner will trigger a script testing for example
with HTTP request your flask app.

Being more efficient with Docker cli

Use aliases to be more efficient, faster and to avoid using tab 1000 times per minute
It will be hard for the first hour, but efficient for the rest of your career 👨🏽‍💻

[~/.zshrc || ~/.bashrc]
alias d="docker"
alias dps="docker ps"
alias dpsa="docker ps -a"
alias dlg="docker logs"
alias dlgf="docker logs -f"
alias drun="docker run"
alias dstp="docker stop"
alias dstr="docker start"
alias dex="docker exec"
alias din="docker inspect"

About

This project is here to store my sample of a Dockerfile. I pref using a sample like this i'll never forget anything.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published