Skip to content

Commit b9eba6c

Browse files
committed
feat: add changes to account for image being built/pushed to github container registry
1 parent 1e675fa commit b9eba6c

File tree

4 files changed

+114
-22
lines changed

4 files changed

+114
-22
lines changed

.github/workflows/publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and Push to GHCR
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
workflow_dispatch:
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: unlockedlabs/golang-jasperstarter
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Log in to GHCR
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ${{ env.REGISTRY }}
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Extract metadata
32+
id: meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36+
tags: |
37+
type=semver,pattern={{version}}
38+
type=raw,value=latest
39+
type=raw,value=1.25-3.6.2
40+
41+
- name: Build and push
42+
uses: docker/build-push-action@v5
43+
with:
44+
context: .
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# Contains Go programming language and JasperStarter for JasperReports
33
# See NOTICES file for third-party software licenses
44

5-
FROM golang:1.23.5-alpine
5+
FROM golang:1.25-alpine
66

77
LABEL maintainer="[email protected]"
88
LABEL org.opencontainers.image.title="Go with JasperStarter"
9-
LABEL org.opencontainers.image.description="Go 1.23 Alpine with JasperStarter 3.6.2 pre-installed"
10-
LABEL org.opencontainers.image.version="1.23-3.6.2"
11-
LABEL org.opencontainers.image.source="https://github.com/unlockedlabs/golang-jasperstarter-docker"
9+
LABEL org.opencontainers.image.description="Go 1.25 Alpine with JasperStarter 3.6.2 pre-installed"
10+
LABEL org.opencontainers.image.version="1.25-3.6.2"
11+
LABEL org.opencontainers.image.source="https://github.com/UnlockedLabs/golang-jasper"
1212
LABEL org.opencontainers.image.licenses="MIT (Dockerfile), BSD-3-Clause (Go), Apache-2.0 (JasperStarter)"
1313

1414
# install Java and dependencies needed for JasperStarter
@@ -34,6 +34,8 @@ RUN mkdir -p /opt/jasperstarter && \
3434

3535
ENV PATH="/opt/jasperstarter/bin:${PATH}"
3636

37+
RUN chmod +x /opt/jasperstarter/bin/jasperstarter
38+
3739
COPY LICENSE NOTICES /usr/share/doc/golang-jasperstarter/
3840

3941
WORKDIR /app

README.md

Lines changed: 59 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
# Go + JasperStarter Docker Image
22

3-
A lightweight Docker base image combining Go 1.23 Alpine with JasperStarter for report generation.
3+
A lightweight Docker base image combining Go 1.25 Alpine with JasperStarter for report generation.
44

55
## What's Included
66

7-
- **Go 1.23** - Go programming language
7+
- **Go 1.25** - Go programming language
88
- **OpenJDK 17** - Java runtime for JasperStarter
99
- **JasperStarter 3.6.2** - Tool to run JasperReports reports
1010
- **Font Support** - Common fonts (FreeFont, Liberation, DejaVu) for PDF generation
1111
- **Alpine Linux** - Small and secure base distribution
1212

1313
## Image Tags
1414

15-
- `golang-jasper:1.23-3.6.2` - Version specific tag
16-
- `golang-jasper:latest` - Latest version
15+
Available on GitHub Container Registry:
16+
17+
- `ghcr.io/unlockedlabs/golang-jasper:1.25-3.6.2` - Version specific tag
18+
- `ghcr.io/unlockedlabs/golang-jasper:latest` - Latest version
1719

1820
## Usage
1921

@@ -22,7 +24,7 @@ A lightweight Docker base image combining Go 1.23 Alpine with JasperStarter for
2224
Use this image as a base for your Go applications that need JasperStarter:
2325

2426
```dockerfile
25-
FROM golang-jasper:1.23-3.6.2
27+
FROM ghcr.io/unlockedlabs/golang-jasper:1.25-3.6.2
2628

2729
# install your Go development tools
2830
RUN go install github.com/air-verse/[email protected]
@@ -39,6 +41,16 @@ EXPOSE 8080
3941
CMD ["air"]
4042
```
4143

44+
### Pulling the Image
45+
46+
```bash
47+
# Pull the latest version
48+
docker pull ghcr.io/unlockedlabs/golang-jasper:latest
49+
50+
# Pull a specific version
51+
docker pull ghcr.io/unlockedlabs/golang-jasper:1.25-3.6.2
52+
```
53+
4254
### Running JasperStarter
4355

4456
The image includes JasperStarter in the PATH, so you can use it directly:
@@ -54,37 +66,53 @@ exec.Command("jasperstarter", "process", "report.jrxml", "-f", "pdf")
5466
## Building the Image
5567

5668
```bash
57-
# clone or copy this directory
58-
cd ~/wkspcs/golang-jasper
69+
# clone this repository
70+
git clone https://github.com/unlockedlabs/golang-jasperstarter-docker.git
71+
cd golang-jasperstarter-docker
5972

6073
# build using the script
6174
./build.sh
6275

6376
# or build manually
64-
docker build -t golang-jasper:1.23-3.6.2 .
65-
docker tag golang-jasper:1.23-3.6.2 golang-jasper:latest
77+
docker build -t ghcr.io/unlockedlabs/golang-jasper:1.25-3.6.2 .
78+
docker tag ghcr.io/unlockedlabs/golang-jasper:1.25-3.6.2 ghcr.io/unlockedlabs/golang-jasper:latest
6679
```
6780

6881
## Pushing to Registry
6982

70-
Edit the `REGISTRY` variable in `build.sh` or specify it when building:
83+
The image is automatically built and pushed to GitHub Container Registry via GitHub Actions on every push to `main` and on version tags.
84+
85+
### Manual Push
86+
87+
Set your GitHub token and run the build script:
7188

7289
```bash
73-
# for Docker Hub
74-
REGISTRY="yourusername/"
90+
export GITHUB_TOKEN=ghp_your_token_here
7591
./build.sh
92+
```
7693

77-
# for private registry
78-
REGISTRY="your-registry.com/yournamespace/"
79-
./build.sh
94+
The script will prompt you to push after building.
95+
96+
### Automated Push (GitHub Actions)
97+
98+
Push to the `main` branch or create a version tag:
99+
100+
```bash
101+
# Trigger build on push to main
102+
git push origin main
103+
104+
# Or create and push a version tag
105+
git tag v1.25-3.6.2
106+
git push origin v1.25-3.6.2
80107
```
81108

82109
## Verification
83110

84111
Test the installation:
85112

86113
```bash
87-
docker run --rm golang-jasper:1.23-3.6.2 jasperstarter --version
114+
docker run --rm ghcr.io/unlockedlabs/golang-jasper:1.25-3.6.2 go version
115+
docker run --rm ghcr.io/unlockedlabs/golang-jasper:1.25-3.6.2 jasperstarter --version
88116
```
89117

90118
## Size Optimization
@@ -104,3 +132,18 @@ The image includes common fonts for PDF generation:
104132
- DejaVu family
105133

106134
Font cache is updated during image build for optimal performance.
135+
136+
## License
137+
138+
This Dockerfile is released under the MIT License. See [LICENSE](LICENSE) for details.
139+
140+
The image includes third-party software with their respective licenses:
141+
142+
- Go: BSD-3-Clause License
143+
- JasperStarter: Apache-2.0 License
144+
145+
See [NOTICES](NOTICES) for complete third-party license information.
146+
147+
## Contributing
148+
149+
Contributions are welcome! Please feel free to submit a Pull Request.

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
# config settings
66
IMAGE_NAME="golang-jasper"
7-
VERSION="1.23-3.6.2"
8-
REGISTRY="carddev81/" # Set your registry here, e.g., "your-registry.com/"
7+
VERSION="1.25-3.6.2"
8+
REGISTRY="ghcr.io/unlockedlabs/" # Set your registry here, e.g., "your-registry.com/"
99
FULL_IMAGE_NAME="${REGISTRY}${IMAGE_NAME}:${VERSION}"
1010

1111
echo "Building ${FULL_IMAGE_NAME}..."

0 commit comments

Comments
 (0)