GitHub Codespaces
This repository is configured to use
GitHub Codespaces to provide a
complete, cloud-based development environment.
How It Works
The configuration is defined in the
.devcontainer/devcontainer.json
file.
This file instructs GitHub Codespaces to:
- Use the Docker Environment: It references our
docker-compose.yml
file to spin up the same
development environment that you would use locally.
- Install VS Code Extensions: It automatically installs a few
recommended Visual Studio Code extensions (Docker and GitLens) to enhance
the development experience.
Getting Started
To get started with Codespaces:
- Click the “Code” button at the top of the repository page.
- Select the “Codespaces” tab.
- Click “Create codespace on main”.
GitHub will prepare your cloud environment, and you will be taken to a
web-based version of VS Code, fully configured and ready to go.
The terminal within VS Code will be inside the running development container.
How to Serve the “pong” Page on Port 80 in a New GitHub Codespace
- Open a Codespace:
- Go to your repository on GitHub.
- Click the Code button, select the Codespaces tab, and create a
new Codespace.
- Start NGINX in the Dev Container:
- Open the integrated terminal in VS Code.
- Run:
- Manually Forward Port 80:
- Open the PORTS tab (bottom panel, tiny icon).
- Click the Forward a Port button (
+
icon).
- Enter
80
as the port number and confirm.
- The url to your codespace instance will now appear in the ‘Forwarded
Ports’ column
- Open the “pong” Page:
- Copy the forwarded URL shown in the PORTS tab (it will look like
https://<codespace-name>-80.app.github.dev/
).
- Open it in your browser:
"$BROWSER" https://<codespace-name>-80.app.github.dev/
You should now see the word pong