Drone CI with Dokcer production deployment confusion - how to deploy a container to a remote host

I want to deploy an application using docker, I’ve made the Dockerfile and tested locally that it is working properly:

  • I run docker build in the project root where the Dockerfile lives;
  • I then run docker run with the newly generate image;

How can I translate this workflow with a continuos integration scenario on a server?

Server A has Gitea and Drone CI setup, now I want to understand how can I make a .drone.yml configuration to build and deploy the application.

I’ve setup the Runner on Server A which is awaiting commands.

Testing the setup

I made a test repository with the following .drone.yml as from the quickstart examples:

kind: pipeline
type: docker
name: default

steps:
- name: greeting
  image: alpine
  commands:
  - echo hello
  - echo world

I then pushed the repo to Gitea and the runner executed properly, in the Drone Dashboard I can see that the steps got executed correctly and I see the output messages in the log. I think that Drone and the Runner are properly setup now.

Context

In this scenario Server A is my development environment, ultimately I want to deploy the container to a remote Server B production, on the subject I have more questions:

  • Can I have a Runner on Server B that only fetches the built image from Server A and deploys it? Do I need to setup a private registry or can I skip this aspect?
  • … or do I need to do everything on the remote Server B?
  • Is the general reasoning right in wanting to split the building and deploying on two separate machines? I am afraid that having the remote Server B Runner also building the image could affect performance on the production machine.