How to setup Github codespaces with custom Docker setup?

by admin
Reading Time: < 1 minute

My project consists out of two components.

│ Docker compose │http  ┌─────────┐
│ (http server,  ├─────►│         │
│  sql server    │      │ Go app  │
│  etc.)         │      │         │
└────────────────┘      └─────────┘
     │ incoming http
  1. A docker compose file containing multiple services (http-server, sql, auth server, etc.). Secondly
  2. A Go app with my custom app logic that the http-server directs certain queries too.

In VScode I usually start up the Docker compose in a Terminal to run all services, and then run the Go app in debug as it contains app logic and receives the http requests that the http-server forwards.

Both components can be build and deployed as a whole via ./Dockerfile.

I now want to run all of this into GitHub Codespaces but I am not sure how to organize my Docker files. Since Go isn’t installed on the Github Codespaces machines, do I need a second Dockerfile in which my Codespace environment runs in like Dockerfile.codespace? Or do I need a Docker compose file instead that collects all components/services including Go?

    Related Posts

    Leave a Comment