Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CI pipeline #3

Merged
merged 9 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build Image and push it to GHCR

on:
push:
tags:
- "v*"
pull_request:
branches:
- "master"

jobs:
build-push:
name: Build & Push
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Get Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push the Image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ The web service is written in Python using the aiohttp web server.
## Usage

To start the webservice just run

```
docker-compose up
docker compose up
```

The html file and and any additional files must be uploaded as multipart/form-data
Expand All @@ -30,3 +31,20 @@ Example:
```
curl -F "html=@tests/index.html" -F "asset.universe.jpg=@tests/universe.jpg" http://localhost:3000 -o test.pdf
```

## Development

For development, you should clone this repo with

```
git clone https://github.com/enertech-ch/weasyprint-docker.git
```

and create a new branch.

To test your changes, you can build the image locally and start your local build with

```
docker compose build weasyprint
docker compose up weasyprint
```
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ services:
build:
context: .
dockerfile: Dockerfile
image: 4teamwork/weasyprint:latest
image: ghcr.io/enertech-ch/weasyprint-docker:latest
ports:
- 3000:8080
- 3000:8080