I am fairly new to both Docker and GitLab and maybe I am a bit in over my head cause I am trying to learn a lot at the same time here. My questions covers several different subjects so if this is not the correct/best place to be asking the questions below please give me some suggestions for where I might post this to get some answers. I have done a lot of searching for this, but found nothing that covers (in combination) what I am attempting.
I have made the beginnings of a Flask application (on Windows 10 / PyCharm) and I would very much like to try to deploy it on Docker containers on an Ubuntu 18.04 server I have set up at home. I have version control to a GitHub repository, but I would like to use GitLab CI to create/build and push new Docker images to the Ubuntu server when the application is updated as I have understood that this is possible. I have come so far that I have set up a Docker container with a GitLab Runner, which I have registered, on my server. I have also linked the Flask app repository on GitHub to GitLab. However, from here I feel a bit stuck and I have several questions.
- Project Structure / Version Control: Currently the structure of my project looks like in the below screenshot. Everything related to the Flask app is under the top level ‘col’ folder which is version controller to GitHub. I want to use Nginx when deploying on the server and as I have understood it is best to have this running in its own container. I that case how should I structure everything in order for the GitLab CI process to work? Should I put all the Flask related stuff in its own directory under the root and then have a separate directory for the Nginx related stuff together with a docker-compose and .gitlab-ci file also under the root?
-
Docker Compose: I am uncertain about how the whole process of creating the actual docker images with GitLab CI works. As mentioned I have installed a GitLab Runner Docker image on my Ubuntu server (I selected the Docker executor when registering it, not sure if this was correct), but do I also need to install Docker Compose? If so, where?
-
Docker-files: How do I write the Dockerfile and docker-compose files? Are they “affected by” and need to be written differently when using GitLab CI than otherwise?
-
Anything else? I am sure the other questions reveals by ignorance with all of this and there is probably other things I need to do and consider for this to work. If anyone has any additional input or tips, links to resources/tutorials, etc. it is much appreciated.