Nginx Webserver with Git Support?

Hello!

I am new on Docker, and i want to know how can i create my first Website using this.
I want to publish a website running on Nginx, but with Git Support so i can edit the website from the running container…

Anyone have a tutorial for this?
Thanks!

Depends on what you want to achieve, do you want to:

  1. build an image, where you use git, so the container will be the same, until you actively build a new version manually

  2. fetch the latest version of your code everytime you start it? (will give you slower startup times)

The best practice way, would be #1, so when you’re ready to publish a new version, you build a image and start a new container, that way, if you find a critical bug, you can always rollback to the old image.

Hello! Yes, number #1 would be the best option for me right now…
Do i need to use Dockerfile for this?

Something like FROM NGINX apt install git ?
I am very new to Docker and i really have no idea on how to do this.

Im fairly familiar with doing this normally without docker tho…

Hi again.

Yes a dockerfile would be the best solution to this, and maybe also the only solution :wink:

Something like this should give you a hint on how to do this:

FROM nginx:latest

RUN apt-get update && apt-get install git && \
    git clone ...   /usr/share/nginx/html/

(not tested)

then:

docker build -t myImage .
docker run -tid myImage