mirror of
https://github.com/dockersrc/windows
synced 2026-06-24 14:01:03 -04:00
🗃️ Deleted workflow files 🗃️
.gitea/workflows/docker.yaml .github/workflows/build-windows.yml .github/workflows/README.md
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
name: windows
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
release-windows:
|
||||
runs-on: act_runner
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
env:
|
||||
RUNNER_TOOL_CACHE: /toolcache
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Get Meta
|
||||
id: meta
|
||||
run: |
|
||||
echo DATE_TAG=$(date +'%y%m') >> $GITHUB_OUTPUT
|
||||
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
|
||||
echo DOCKER_ORG=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $1}') >> $GITHUB_OUTPUT
|
||||
echo DOCKER_TAG=$([ -n "$DOCKER_TAG" ] && echo ${DOCKER_TAG} || echo "latest") >> $GITHUB_OUTPUT
|
||||
echo DOCKER_HUB=$([ -n "$DOCKER_HUB" ] && echo ${DOCKER_HUB} || echo "docker.io") >> $GITHUB_OUTPUT
|
||||
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | sed 's|^docker-||g') >> $GITHUB_OUTPUT
|
||||
echo "$DOCKER_HUB/$DOCKER_ORG/$REPO_NAME:$DOCKER_TAG"
|
||||
|
||||
- name: Set up Docker BuildX
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
registry: ${{ steps.meta.outputs.DOCKER_HUB }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: |
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
push: true
|
||||
build-args: |
|
||||
IMAGE_NAME=${{ steps.meta.outputs.REPO_NAME }}
|
||||
BUILD_DATE=$(date -u +'%Y%m%d%H%M')
|
||||
BUILD_VERSION=$(date -u +'%Y%m%d%H%M')
|
||||
GIT_COMMIT=${{ github.sha }}
|
||||
TIMEZONE=America/New_York
|
||||
LANGUAGE=en_US.UTF-8
|
||||
LICENSE=WTFPL
|
||||
TZ=America/New_York
|
||||
tags: |
|
||||
${{ steps.meta.outputs.DOCKER_HUB }}/${{ steps.meta.outputs.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.DATE_TAG }}
|
||||
${{ steps.meta.outputs.DOCKER_HUB }}/${{ steps.meta.outputs.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.DOCKER_TAG }}
|
||||
@@ -1,130 +0,0 @@
|
||||
# GitHub Actions Workflow for Windows Container
|
||||
|
||||
This workflow **fully automates** building Windows Server Core containers using GitHub Actions variables.
|
||||
|
||||
## 🤖 Fully Automated Setup
|
||||
|
||||
### 1. Set Variables (One-time setup)
|
||||
|
||||
**Settings → Secrets and variables → Actions → Variables tab → New repository variable**
|
||||
|
||||
Add this variable:
|
||||
- `DOCKER_USERNAME` - Your Docker Hub username (e.g., `casjaysdevdocker`)
|
||||
|
||||
**Settings → Secrets and variables → Actions → Secrets tab → New repository secret**
|
||||
|
||||
Add this secret:
|
||||
- `DOCKER_PASSWORD` - Your Docker Hub password or access token
|
||||
|
||||
### 2. That's It! 🎉
|
||||
|
||||
The workflow automatically:
|
||||
- ✅ Builds on every push to main/master/develop
|
||||
- ✅ Builds monthly (1st of month at 2 AM UTC)
|
||||
- ✅ Auto-detects repo name from GitHub
|
||||
- ✅ Auto-generates image name: `<username>/<repo-name>`
|
||||
- ✅ Auto-creates tags: `latest` and `YYMM` format
|
||||
- ✅ Auto-extracts metadata from git
|
||||
- ✅ Auto-pushes to Docker Hub (if credentials set)
|
||||
- ✅ Creates build summary in Actions tab
|
||||
|
||||
## 🏷️ Automatic Image Tags
|
||||
|
||||
**Format**: `<DOCKER_USERNAME>/<repo-name>:<tag>`
|
||||
|
||||
Examples for January 2026:
|
||||
- `casjaysdevdocker/windows:latest`
|
||||
- `casjaysdevdocker/windows:2601`
|
||||
|
||||
## ⚙️ Automatic Metadata
|
||||
|
||||
All OCI labels and annotations automatically include:
|
||||
- Build date and time
|
||||
- Git commit hash (short)
|
||||
- Repository URL from GitHub
|
||||
- Docker Hub URL
|
||||
- Version (YYMM format)
|
||||
|
||||
## 🔄 When Builds Run
|
||||
|
||||
1. **On Push** - Any push to main/master/develop branches
|
||||
2. **On Pull Request** - Tests build but doesn't push
|
||||
3. **Monthly** - Automatic rebuild on 1st of each month at 2 AM UTC
|
||||
4. **Manual** - Click "Run workflow" in Actions tab
|
||||
|
||||
## 📊 Build Summary
|
||||
|
||||
After each successful build, check the Actions tab for:
|
||||
- Image name and tags
|
||||
- Build date and commit
|
||||
- Pull command
|
||||
- Image size
|
||||
- All metadata labels
|
||||
|
||||
## 🚫 No Variables? No Problem!
|
||||
|
||||
If `DOCKER_USERNAME` variable is not set:
|
||||
- Falls back to repository owner name
|
||||
- Example: `owner/windows:latest`
|
||||
|
||||
If `DOCKER_PASSWORD` secret is not set:
|
||||
- Build and test still run
|
||||
- Push step is automatically skipped
|
||||
- Perfect for testing or forked repos
|
||||
|
||||
## 📝 Example Output
|
||||
|
||||
```
|
||||
## 📦 Container Build Summary
|
||||
|
||||
**Image:** `casjaysdevdocker/windows`
|
||||
**Tags:**
|
||||
- `latest`
|
||||
- `2601`
|
||||
|
||||
**Build Date:** 202601231800
|
||||
**Commit:** `a1b2c3d`
|
||||
|
||||
### 🚀 Pull Command
|
||||
```powershell
|
||||
docker pull casjaysdevdocker/windows:latest
|
||||
```
|
||||
|
||||
## 🔧 Advanced: Override Image Name
|
||||
|
||||
Want to use a different Docker Hub username? Just set the variable:
|
||||
|
||||
**Settings → Secrets and variables → Actions → Variables**
|
||||
- `DOCKER_USERNAME` = `yourusername`
|
||||
|
||||
Result: `yourusername/windows:latest`
|
||||
|
||||
## 🛠️ Troubleshooting
|
||||
|
||||
### Build succeeds but doesn't push
|
||||
- Check that `DOCKER_PASSWORD` secret is set
|
||||
- Verify `DOCKER_USERNAME` variable or repo owner is correct
|
||||
- Ensure you're not building from a pull request
|
||||
|
||||
### Wrong image name
|
||||
- Set `DOCKER_USERNAME` variable to your Docker Hub username
|
||||
- Or it defaults to GitHub repo owner
|
||||
|
||||
### Need different tags?
|
||||
- Edit `.github/workflows/build-windows.yml`
|
||||
- Modify the `TAG_YYMM` format in the metadata step
|
||||
|
||||
## 📅 Monthly Auto-Build
|
||||
|
||||
The workflow includes a cron schedule:
|
||||
```yaml
|
||||
schedule:
|
||||
- cron: '0 2 1 * *' # 1st of month at 2 AM UTC
|
||||
```
|
||||
|
||||
This ensures:
|
||||
- Fresh base image updates
|
||||
- Latest security patches
|
||||
- Regular image rebuilds
|
||||
|
||||
To disable: Remove the `schedule:` section from the workflow file.
|
||||
@@ -1,176 +0,0 @@
|
||||
name: Build Windows Container
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 2 1 * *' # Build monthly on 1st at 2 AM UTC
|
||||
|
||||
env:
|
||||
REGISTRY: docker.io
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2022
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
run: |
|
||||
$BUILD_DATE = Get-Date -Format "yyyyMMddHHmm"
|
||||
$TAG_YYMM = Get-Date -Format "yyMM"
|
||||
$GIT_COMMIT = $env:GITHUB_SHA.Substring(0,7)
|
||||
|
||||
# Extract repo name from GITHUB_REPOSITORY (owner/repo)
|
||||
$REPO_NAME = $env:GITHUB_REPOSITORY.Split('/')[1]
|
||||
|
||||
# Get Docker username from variables, fallback to repo owner
|
||||
$DOCKER_USER = "${{ vars.DOCKER_USERNAME }}"
|
||||
if ([string]::IsNullOrWhiteSpace($DOCKER_USER)) {
|
||||
$DOCKER_USER = $env:GITHUB_REPOSITORY.Split('/')[0]
|
||||
}
|
||||
|
||||
$IMAGE_NAME = "$DOCKER_USER/$REPO_NAME"
|
||||
|
||||
echo "BUILD_DATE=$BUILD_DATE" >> $env:GITHUB_ENV
|
||||
echo "TAG_YYMM=$TAG_YYMM" >> $env:GITHUB_ENV
|
||||
echo "GIT_COMMIT=$GIT_COMMIT" >> $env:GITHUB_ENV
|
||||
echo "IMAGE_NAME=$IMAGE_NAME" >> $env:GITHUB_ENV
|
||||
echo "REPO_NAME=$REPO_NAME" >> $env:GITHUB_ENV
|
||||
|
||||
Write-Host "Image Name: $IMAGE_NAME"
|
||||
Write-Host "Build Date: $BUILD_DATE"
|
||||
Write-Host "Tag YYMM: $TAG_YYMM"
|
||||
Write-Host "Git Commit: $GIT_COMMIT"
|
||||
shell: powershell
|
||||
|
||||
- name: Build Docker image with annotations
|
||||
run: |
|
||||
docker build `
|
||||
--build-arg BUILD_DATE=$env:BUILD_DATE `
|
||||
--build-arg GIT_COMMIT=$env:GIT_COMMIT `
|
||||
--label "maintainer=CasjaysDev <docker-admin@casjaysdev.pro>" `
|
||||
--label "org.opencontainers.image.vendor=CasjaysDev" `
|
||||
--label "org.opencontainers.image.authors=CasjaysDev" `
|
||||
--label "org.opencontainers.image.description=Containerized version of $env:REPO_NAME" `
|
||||
--label "org.opencontainers.image.title=$env:REPO_NAME" `
|
||||
--label "org.opencontainers.image.base.name=$env:REPO_NAME" `
|
||||
--label "org.opencontainers.image.licenses=WTFPL" `
|
||||
--label "org.opencontainers.image.created=$env:BUILD_DATE" `
|
||||
--label "org.opencontainers.image.version=$env:TAG_YYMM" `
|
||||
--label "org.opencontainers.image.url=https://hub.docker.com/r/$env:IMAGE_NAME" `
|
||||
--label "org.opencontainers.image.source=$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY" `
|
||||
--label "org.opencontainers.image.vcs-type=Git" `
|
||||
--label "org.opencontainers.image.revision=$env:GIT_COMMIT" `
|
||||
--label "org.opencontainers.image.documentation=$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY" `
|
||||
--label "com.github.containers.toolbox=false" `
|
||||
--annotation "maintainer=CasjaysDev <docker-admin@casjaysdev.pro>" `
|
||||
--annotation "org.opencontainers.image.vendor=CasjaysDev" `
|
||||
--annotation "org.opencontainers.image.authors=CasjaysDev" `
|
||||
--annotation "org.opencontainers.image.description=Containerized version of $env:REPO_NAME" `
|
||||
--annotation "org.opencontainers.image.title=$env:REPO_NAME" `
|
||||
--annotation "org.opencontainers.image.base.name=$env:REPO_NAME" `
|
||||
--annotation "org.opencontainers.image.licenses=WTFPL" `
|
||||
--annotation "org.opencontainers.image.created=$env:BUILD_DATE" `
|
||||
--annotation "org.opencontainers.image.version=$env:TAG_YYMM" `
|
||||
--annotation "org.opencontainers.image.url=https://hub.docker.com/r/$env:IMAGE_NAME" `
|
||||
--annotation "org.opencontainers.image.source=$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY" `
|
||||
--annotation "org.opencontainers.image.vcs-type=Git" `
|
||||
--annotation "org.opencontainers.image.revision=$env:GIT_COMMIT" `
|
||||
--annotation "org.opencontainers.image.documentation=$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY" `
|
||||
--annotation "com.github.containers.toolbox=false" `
|
||||
--tag $env:IMAGE_NAME`:latest `
|
||||
--tag $env:IMAGE_NAME`:$env:TAG_YYMM `
|
||||
.
|
||||
shell: powershell
|
||||
|
||||
- name: Test container
|
||||
run: |
|
||||
Write-Host "Starting container for testing..."
|
||||
docker run -d --name test-container $env:IMAGE_NAME`:latest
|
||||
Start-Sleep -Seconds 10
|
||||
|
||||
Write-Host "Checking container health..."
|
||||
docker ps -a
|
||||
|
||||
$containerStatus = docker inspect test-container --format='{{.State.Status}}'
|
||||
Write-Host "Container status: $containerStatus"
|
||||
|
||||
if ($containerStatus -ne "running") {
|
||||
Write-Host "Container logs:"
|
||||
docker logs test-container
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Testing healthcheck..."
|
||||
docker exec test-container powershell -Command "C:/Windows/System32/entrypoint.ps1 healthcheck"
|
||||
|
||||
Write-Host "Stopping test container..."
|
||||
docker stop test-container
|
||||
docker rm test-container
|
||||
shell: powershell
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request' && secrets.DOCKER_PASSWORD != ''
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ vars.DOCKER_USERNAME || github.repository_owner }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Push to Docker Hub
|
||||
if: github.event_name != 'pull_request' && secrets.DOCKER_PASSWORD != ''
|
||||
run: |
|
||||
Write-Host "Pushing $env:IMAGE_NAME`:latest..."
|
||||
docker push $env:IMAGE_NAME`:latest
|
||||
|
||||
Write-Host "Pushing $env:IMAGE_NAME`:$env:TAG_YYMM..."
|
||||
docker push $env:IMAGE_NAME`:$env:TAG_YYMM
|
||||
|
||||
Write-Host "=== Images pushed successfully ==="
|
||||
Write-Host "Latest: $env:IMAGE_NAME`:latest"
|
||||
Write-Host "Monthly: $env:IMAGE_NAME`:$env:TAG_YYMM"
|
||||
shell: powershell
|
||||
|
||||
- name: Image details
|
||||
if: always()
|
||||
run: |
|
||||
Write-Host "=== Built Images ==="
|
||||
docker images $env:IMAGE_NAME
|
||||
|
||||
Write-Host "`n=== Image Labels ==="
|
||||
docker inspect $env:IMAGE_NAME`:latest --format='{{json .Config.Labels}}' | ConvertFrom-Json | Format-List
|
||||
|
||||
Write-Host "`n=== Image Size ==="
|
||||
$size = docker images $env:IMAGE_NAME`:latest --format='{{.Size}}'
|
||||
Write-Host "Image size: $size"
|
||||
shell: powershell
|
||||
|
||||
- name: Create release summary
|
||||
if: github.event_name != 'pull_request'
|
||||
run: |
|
||||
Write-Host "## 📦 Container Build Summary" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "**Image:** ``$env:IMAGE_NAME``" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "**Tags:**" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "- ``latest``" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "- ``$env:TAG_YYMM``" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "**Build Date:** $env:BUILD_DATE" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "**Commit:** ``$env:GIT_COMMIT``" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "### 🚀 Pull Command" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host '```powershell' >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host "docker pull $env:IMAGE_NAME`:latest" >> $env:GITHUB_STEP_SUMMARY
|
||||
Write-Host '```' >> $env:GITHUB_STEP_SUMMARY
|
||||
shell: powershell
|
||||
Reference in New Issue
Block a user