Skip to content

Commit d2be758

Browse files
committed
Initial version
0 parents  commit d2be758

File tree

3 files changed

+122
-0
lines changed

3 files changed

+122
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Nightly Docker Build
2+
3+
on:
4+
schedule:
5+
# Run every night at 2 AM UTC
6+
- cron: '0 2 * * *'
7+
workflow_dispatch: # Allow manual triggering
8+
9+
env:
10+
REGISTRY_NAME: ${{ secrets.ACR_LOGIN_SERVER }}
11+
IMAGE_NAME: aspnet-noble-ghostscript
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Log in to Azure Container Registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ${{ secrets.ACR_LOGIN_SERVER }}
28+
username: ${{ secrets.ACR_USERNAME }}
29+
password: ${{ secrets.ACR_PASSWORD }}
30+
31+
- name: Build and push Docker image
32+
id: build
33+
uses: docker/build-push-action@v5
34+
with:
35+
context: .
36+
file: ./Dockerfile
37+
push: true
38+
tags: ${{ secrets.ACR_LOGIN_SERVER }}/${{ env.IMAGE_NAME }}:latest
39+
cache-from: type=gha
40+
cache-to: type=gha,mode=max
41+
42+
- name: Image digest
43+
run: echo ${{ steps.build.outputs.digest }}

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble
2+
RUN apt-get update && apt-get install -y ghostscript zbar-tools
3+
4+
5+
ENV GhostScriptSettings__Executable="/usr/bin/gs"
6+
ENV GhostScriptSettings__Parameter="-sDEVICE=pdfwrite -o \"{1}\" -dCompatibilityLevel=\"1.4\" -dPDFSETTINGS=\"/screen\" -dNOPAUSE -dQUIET -dBATCH \"{0}\""
7+
ENV GhostScriptSettings__WorkDir="/tmp"
8+
RUN /usr/bin/gs --version
9+
WORKDIR /app

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# ASP.NET Noble Ghostscript Docker Image
2+
3+
This repository contains a Docker image based on ASP.NET 10.0 Noble with Ghostscript and zbar-tools installed.
4+
5+
## Docker Image
6+
7+
The Dockerfile creates an image with:
8+
- Base: `mcr.microsoft.com/dotnet/aspnet:10.0-noble`
9+
- Ghostscript for PDF processing
10+
- zbar-tools for barcode/QR code processing
11+
- Pre-configured GhostScript settings
12+
13+
## GitHub Actions CI/CD
14+
15+
### Nightly Builds
16+
17+
The repository includes a GitHub Actions workflow that:
18+
- Runs nightly at 2 AM UTC
19+
- Builds the Docker image
20+
- Pushes to Azure Container Registry
21+
- Supports manual triggering via `workflow_dispatch`
22+
23+
### Required GitHub Secrets
24+
25+
To use the GitHub Actions workflow, you need to configure the following secrets in your repository:
26+
27+
1. **ACR_LOGIN_SERVER** - Your Azure Container Registry login server URL
28+
- Example: `myregistry.azurecr.io`
29+
30+
2. **ACR_USERNAME** - Your Azure Container Registry username
31+
- Example: `myregistry` (usually the same as registry name)
32+
33+
3. **ACR_PASSWORD** - Your Azure Container Registry password
34+
- You can get this from Azure Portal > Container Registry > Access Keys
35+
36+
### Setting up GitHub Secrets
37+
38+
1. Go to your GitHub repository
39+
2. Navigate to Settings > Secrets and variables > Actions
40+
3. Click "New repository secret"
41+
4. Add each of the three secrets listed above
42+
43+
### Workflow Features
44+
45+
- **Scheduled builds**: Runs automatically every night at 2 AM UTC
46+
- **Manual triggers**: Can be triggered manually from the Actions tab
47+
- **Simple tagging**: Uses only the `latest` tag for all builds
48+
- **Build caching**: Uses GitHub Actions cache for faster builds
49+
- **Buildx support**: Uses Docker Buildx for advanced build features
50+
51+
### Image Tags
52+
53+
The workflow creates a single tag:
54+
- `latest` - All builds are tagged as latest, overwriting the previous version
55+
56+
## Usage
57+
58+
Once the image is built and pushed to your Azure Container Registry, you can pull it using:
59+
60+
```bash
61+
docker pull <your-registry>.azurecr.io/aspnet-noble-ghostscript:latest
62+
```
63+
64+
## Environment Variables
65+
66+
The image includes pre-configured environment variables for GhostScript:
67+
68+
- `GhostScriptSettings__Executable="/usr/bin/gs"`
69+
- `GhostScriptSettings__Parameter="-sDEVICE=pdfwrite -o \"{1}\" -dCompatibilityLevel=\"1.4\" -dPDFSETTINGS=\"/screen\" -dNOPAUSE -dQUIET -dBATCH \"{0}\""`
70+
- `GhostScriptSettings__WorkDir="/tmp"`

0 commit comments

Comments
 (0)