# GitLab CI and Docker Compose for Continuous Deployment --- ## Motivation - ***Instead of running commands on the server, you script the commands that you run on the server in order to make a deployment*** - In our context, since we're using Docker Compose, this is essentially a `docker-compose up -d`. --- ## Note in the context of Diaverum - When you run `docker compose up -d`, this normally would download the images from the DockerHub registry. - However, we're in an air-tight environment, so we have to download and re-upload the images we need. ---- ## Note in the context of Diaverum - ***Download***: use a general purpose GitLab runner will make it available to download from DockerHub. - ***Upload***: re-tag the download docker image with the tag given from the repository's Container Registry --- ## `.gitlab-ci.yml` - this file is where you put the commands to make the deployment for you - [sample file](http://gitlab.diaverum.net:8800/ai-platform/infrastructure/docker-stacks/minio/-/blob/main/.gitlab-ci.yml) - [docs](https://docs.gitlab.com/ee/ci/yaml/gitlab_ci_yaml.html) --- ## `docker-compose.yml` - this file is where you define the service(s) that you want to deploy - [sample file](http://gitlab.diaverum.net:8800/ai-platform/infrastructure/docker-stacks/prefect/-/blob/master/docker-compose.yml) - [docs](https://docs.docker.com/compose/compose-file/) ---- - networks - volumes - services - `ports` - `networks` - `ports` - `image` - `container_name` example: [prefect deployment](http://gitlab.diaverum.net:8800/ai-platform/infrastructure/docker-stacks/prefect/-/blob/master/docker-compose.yml) ---- > - networks > - volumes > - services > - `ports` > - `networks` > - `ports` > - `image` > - `container_name` - services in the same networks can refer to each other by their service name - volumes are local to the machine - images is the software that you want to run e.g. postgres --- ## Gitlab runners This is where the build, upload and deployment **jobs** run
{"metaMigratedAt":"2023-06-18T03:51:19.034Z","metaMigratedFrom":"YAML","title":"GitLab CI and Docker Compose for Continuous Deployment","breaks":true,"slideOptions":"{\"theme\":\"white\",\"spotlight\":{\"enabled\":false}}","contributors":"[{\"id\":\"d23f880b-57d2-43a2-b517-3af966306275\",\"add\":3255,\"del\":985}]"}
    180 views
   Owned this note