New to the Devop world so my terminology may be limited or incorrect. I have a self-hosted gitlab server. I had a "hello world" container project that spun up a "hello world" golang app. I was able to get the CI/CD pipeline set up that would build the container, push it to the self hosted gitlab container registry, and deploy it to a running Linode server. My next step is to docker compose the golang container with nginx and certbot. If I ssh into the server and clone the repository, it runs. Now I am trying to deploy the compose to a Linode server. That is where I am currently at the posting of the question(s).
(1) One way would be to use ssh in the pipeline to "git pull" and build/up the compose file just like I did running locally on the remote docker host.
(2) After trying to do some research on the subject, I ran across something about "docker context". It looks like I could point my runner running the pipeline to point the remote docker host, and then the build/up command would be working on that server. I started a "hello world" pipeline to test that idea, but now I "think" I am fighting a CI/CD issue. Just to test the syntax of the command, I copied/pasted it into the command line on the remote server, I know it needs to be ran on the runner it was just an easy place to test the syntax, it does not throw an error. This is a protected branch and is therefore feels like it needs to mask part of the command. Is that my problem?
So my docker context command is
testcontext-job:
stage: testcontext
image: docker:latest
script:
- docker context ls
- export DOCKER_HOST
- docker context create remote ‐‐docker host=ssh://[email protected]
- docker context ls
I tried to narrow down the questions, hoping to give context to better questions. If option 1 is an accepted practice, I will not waste more time chasing the "docker context" rabbit.
Maybe I need to look at a 3rd option. :-)
