1. Create an Artifact Registry repository
2. Setup setting
3. Open terminal
4. Configure Docker Authentication
1
gcloud auth configure-docker northamerica-northeast2-docker.pkg.dev
5. Building and Pushing Docker Images
Upload source code to Cloud Shell
Building and Pushing Docker Images
1
2
3
4
5
6
7
8
# Build the image
docker build -t [image-name] .
# Tag the image for GCP
docker tag [image-name] northamerica-northeast2-docker.pkg.dev/[project-id]/[repository-name]/[image-name]:[tag]
# Push the image
docker push northamerica-northeast2-docker.pkg.dev/[project-id]/[repository-name]/[image-name]:[tag]
Example
1
2
3
docker build -t myapp .
docker tag myapp northamerica-northeast2-docker.pkg.dev/my-project-123/my-repo/myapp:latest
docker push northamerica-northeast2-docker.pkg.dev/my-project-123/my-repo/myapp:latest
6. Setting up VM Instance
Create VM Instance
1
2
3
4
5
gcloud compute instances create mediasoup-instance \
--zone=northamerica-northeast2-a \
--machine-type=e2-medium \
--image-family=debian-11 \
--image-project=debian-cloud
Configure Firewall Rules
1
2
3
4
5
6
7
8
# Allow Docker and server related ports
gcloud compute firewall-rules create mediasoup-ports \
--direction=INGRESS \
--priority=1000 \
--network=default \
--action=ALLOW \
--rules=tcp:80,tcp:443,tcp:22,tcp:10000-59999,udp:10000-59999 \
--source-ranges=0.0.0.0/0
7. Set up Static IP
Create a static IP
1
2
gcloud compute addresses create mediasoup-ip \
--region=northamerica-northeast2
Assign the IP to VM
1
2
3
gcloud compute instances add-access-config mediasoup-instance \
--zone=northamerica-northeast2-a \
--address=[Generated-IP-address]
8. Checking Docker processes
1
service docker start
if Docker is not running,
1
sudo service docker start