Skip to content

Commit

Permalink
Setup .devcontainer for a GitHub Codespace (#19)
Browse files Browse the repository at this point in the history
* Create a Codespace image with required tools for ops work.
* Add docs for GPG signing in a Codespace.
  • Loading branch information
JuliusSkylerSladeUSDS authored Jan 6, 2025
1 parent 8983ae2 commit ed8825e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# The universal image contains many useful tools including Docker-in-Docker already set up.
FROM mcr.microsoft.com/vscode/devcontainers/universal

# Add Cloud Foundry cf cli
# The package source is unstable (frequent 401s) so we install the package directly.
RUN curl -L -o /tmp/cf8.deb https://github.com/cloudfoundry/cli/releases/download/v8.8.3/cf8-cli-installer_8.8.3_x86-64.deb \
&& dpkg -i /tmp/cf8.deb \
&& rm /tmp/cf8.deb

# Install other helpful tools
RUN apt-get update \
&& apt-get install -y netcat \
&& apt-get install -y postgresql-client

# Install the cf-service-connect plugin to allow easy access to Postgres
# See: https://github.com/cloud-gov/cf-service-connect
# Note: versions > 1.1.3 require a newer version of glibc than we have (2.31).
USER codespace
RUN /usr/bin/cf install-plugin https://github.com/cloud-gov/cf-service-connect/releases/download/v1.1.3/cf-service-connect_linux_amd64 -f
USER root
5 changes: 5 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"build": {
"dockerfile": "Dockerfile"
}
}
15 changes: 15 additions & 0 deletions docs/localDevelopment.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,18 @@ Clean up:
docker volume rm $(docker volume ls -q) # Removes local docker volumes
docker rm -f $(docker ps -aq) # Removes local docker containers
```

### GitHub Codespace
This repo is configured with a [.devcontainer](/.devcontainer) to allow you to do development
and ops work from within a GitHub Codespace.

#### Signing Commits
GitHub will refuse to recognize any other gpg key than the one that _it_ wants to sign with inside of
the Codespace, which it automatically sets up for you. At least, as far as I've been able to
determine. If you want signed commits (i.e. if your branch protection rules require it), just
click the checkbox to enable GPG signing in your GitHub Codespaces settings (the settings attached
to your GitHub account) and `git` in the Codespace will handle signing commits for you
automatically. It'll work out of the box and you don't need to do anything else to enable this.

Presumably this is handled automatically within VSCode as well if you want to use its GUI git
tools, but I haven't tested this.

0 comments on commit ed8825e

Please sign in to comment.