Skip to content

Commit

Permalink
Merge pull request #38 from tuxmea/docker_container
Browse files Browse the repository at this point in the history
Voxpupuli Docker container in github actions
  • Loading branch information
rwaffen authored Jul 10, 2023
2 parents c825a22 + 148e599 commit ce57322
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
21 changes: 21 additions & 0 deletions .github/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---

# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking changes
labels:
- backwards-incompatible
- title: Implemented enhancements
labels:
- enhancement
- title: Fixed bugs
labels:
- bug
- title: Merged pull requests
labels:
- "*"
61 changes: 61 additions & 0 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: publish 🐳 Docker image

on:
push:
paths-ignore:
- '.github/**'
branches:
- 'master'
tags:
- '*'

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get tags
shell: python
run: |
import re
import os
from packaging.version import parse
image = "ghcr.io/${{ github.repository }}"
tags = set()
version = "${{ github.ref_name }}"
if version.startswith('v'):
version = "${{ github.ref_name }}".replace("v", "")
tags.add(f"{image}:latest")
if version == 'master':
version = "development"
tags.add(f"{image}:{version}")
tags = ",".join(sorted(list(tags)))
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'tags={tags}', file=fh)
id: tags

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.tags.outputs.tags }}
31 changes: 31 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---

on:
- pull_request

name: CI

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@2.0.0
with:
scandir: './'

build_docker_image:
name: 'Built test Docker image'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
push: false
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM bitnami/nginx:latest
FROM nginx:latest

MAINTAINER raphael.pinson@camptocamp.com
MAINTAINER pmc@voxpupuli.org

COPY . /app
COPY . /usr/share/nginx/html/
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Using with Docker
-----------------

```shell
$ docker run -ti -p 8080:8080 camptocamp/puppet-catalog-diff-viewer
$ docker run -ti -p 8080:8080 ghcr.io/voxpupuli/puppet-catalog-diff-viewer
```

will let you access the catalog diff viewer at [http://localhost:8080](http://localhost:8080).
Expand Down Expand Up @@ -58,7 +58,7 @@ With the docker image, you can put everything in `/data`:
$ docker run -ti \
-v ./data:/data \
-p 8080:8080 \
camptocamp/puppet-catalog-diff-viewer
ghcr.io/voxpupuli/puppet-catalog-diff-viewer
```


Expand All @@ -79,7 +79,7 @@ With the docker image, you can use:
$ docker run -ti \
-v ./s3_credentials.js:/data/s3_credentials.js:ro \
-p 8080:8080 \
camptocamp/puppet-catalog-diff-viewer
ghcr.io/voxpupuli/puppet-catalog-diff-viewer
```

or using environment variables:
Expand All @@ -90,7 +90,7 @@ $ docker run -ti \
-e S3_ACCESS_KEY=your-access-key \
-e S3_SECRET_KEY=your-secret-key \
-p 8080:8080 \
camptocamp/puppet-catalog-diff-viewer
ghcr.io/voxpupuli/puppet-catalog-diff-viewer
```

Make sure the access key belongs to a user that can perform actions `s3:GetObject` and `s3:ListBucket` on the bucket. Here is an example bucket policy you can use to upload files from the catalog-diff machine and retrieve them in the viewer:
Expand Down

0 comments on commit ce57322

Please sign in to comment.