All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 3m24s
|
||
---|---|---|
.copilot | ||
.devcontainer | ||
.forgejo/workflows | ||
drop-in | ||
.dockerignore | ||
Dockerfile | ||
DROP-IN.md | ||
Readme.md |
OCI Dev Container Template
Overview
This### Using in Other Projects
🚀 Drop-in Setup:
One command in any repo:
mkdir -p .devcontainer && curl -o .devcontainer/devcontainer.json https://raw.githubusercontent.com/your-username/oci-dev-container-template/main/drop-in/devcontainer.json
Then open in VSCode → "Reopen in Container" → Done!
**📖 See DROP-IN.md for setup instructions and customization options.**as a template for creating containerized development environments that are compatible with both VSCode Dev Containers and automated OCI registry publishing workflows.
Features
VSCode Dev Container Support
- Base Image: Ubuntu 22.04 with development tools
- Non-root User: Configured with
vscode
user for security - Pre-installed Tools: Git, build tools, network utilities, Go 1.21.6 (multi-arch: amd64/arm64)
- VSCode Extensions: Docker, GitHub Actions, YAML, PowerShell, Go language support
- Dev Container Features: Git, Docker-in-Docker, GitHub CLI
Automated Build Workflows
Two GitHub Actions workflows automate Docker image building and publishing:
-
On Commit to Main
- Trigger: Activates on commits to the
main
branch (tags are excluded). - Purpose: Builds and publishes a Docker image for each commit.
- Trigger: Activates on commits to the
-
On Tag Push
- Trigger: Activates when a new tag is pushed.
- Purpose: Builds and publishes a Docker image for the tag and tags it as
latest
.
Getting Started
Using as a Dev Container
-
Prerequisites:
- VSCode with Dev Containers extension installed
- Docker Desktop running
-
Open in Dev Container:
- Clone this repository
- Open in VSCode
- When prompted, click "Reopen in Container"
- Or use Command Palette: "Dev Containers: Reopen in Container"
-
Manual Setup:
git clone <your-repo-url> cd oci-dev-container-template code .
Using in Other Projects
<EFBFBD> FASTEST: Drop-in Setup (Recommended)
One command in any repo:
mkdir -p .devcontainer && curl -o .devcontainer/devcontainer.json https://raw.githubusercontent.com/your-username/oci-dev-container-template/main/drop-in/devcontainer.json
Then open in VSCode → "Reopen in Container" → Done!
📖 See DROP-IN.md for the ultimate simple setup guide.
📖 See USAGE.md for advanced usage and customization options.
Quick options:
- Method 1: Reference pre-built image directly (fastest)
- Method 2: Extend with project-specific Dockerfile
- Method 3: Build from Git repository source
Using for Auto-Build
- Clone the Repository: Get a local copy of this repository.
- Modify Dockerfile: Update the
Dockerfile
for your application needs. - Configure Secrets: Add required secrets to your repository:
OCI_TOKEN
: Your OCI registry tokenOCI_USER
: Your OCI registry username
- Push Changes: Push changes to the
main
branch or create a new tag. - Check Workflow Status: View the Actions tab to monitor workflow runs.
Customization
Dev Container Configuration
- Modify
.devcontainer/devcontainer.json
to:- Add additional VSCode extensions
- Configure port forwarding
- Add post-creation commands
- Customize container features
Dockerfile Enhancement
- Add language-specific tools and runtimes
- Install additional development dependencies
- Configure environment variables
- Set up project-specific tooling
Directory Structure
.
├── .devcontainer/
│ └── devcontainer.json # Dev container configuration
├── .copilot/ # Agent logging and context
├── drop-in/ # Simple setup for other projects
│ ├── devcontainer.json # Minimal drop-in config
│ └── setup-devcontainer.ps1 # Windows setup script
├── Dockerfile # Container definition
├── .dockerignore # Docker build optimization
├── DROP-IN.md # Simple drop-in setup guide
└── README.md # This file
Notes
- The container supports multi-platform builds if necessary
- Development tools are pre-installed for immediate productivity
- Non-root user configuration enhances security
- Docker-in-Docker support enables container development within the dev container
License
This project is licensed under the MIT License. See the LICENSE file for details.