Skip to content

Commit

Permalink
Merge pull request #3 from Estivador/upgrade_python
Browse files Browse the repository at this point in the history
Upgrade python
  • Loading branch information
zxpower authored Jul 17, 2023
2 parents a643de6 + b31c5ed commit 4f9bee8
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 7 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/master_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Main Branch CI Image Build
on:
push:
branches: master
jobs:
build-image:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/Estivador/traefik-certificate-extractor
tags: |
type=sha,prefix=
flavor: |
latest=true
prefix=
suffix=
labels: |
org.opencontainers.image.vendor=Estivador
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build image and push to GitHub Container Registry
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
37 changes: 37 additions & 0 deletions .github/workflows/pr_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PR CI Image Build
on: pull_request
jobs:
build-image:
name: Build Docker and push image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/Estivador/traefik-certificate-extractor
tags: |
type=sha,prefix=pr-
flavor: |
latest=false
prefix=
suffix=
labels: |
org.opencontainers.image.vendor=Estivador
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build image and push to GitHub Container Registry
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use Python on Alpine Linux as base image
FROM python:alpine
FROM python:3.11-alpine

# Create working directory
RUN mkdir -p /app
Expand All @@ -12,7 +12,7 @@ COPY requirements.txt /app
RUN pip3 install -r requirements.txt

# Copy app source
COPY . /app
COPY extractor.py /app

# Define entrypoint of the app
ENTRYPOINT ["python3", "-u", "extractor.py", "-c", "data/acme.json", "-d", "certs"]
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Daniel Huisman, (c) 2020 Reinholds Zviedris
Copyright (c) 2018 Daniel Huisman, (c) 2023 Reinholds Zviedris

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ docker run --name extractor -d \
-v /opt/traefik:/app/data \
-v ./certs:/app/certs \
-v /var/run/docker.socket:/var/run/docker.socket \
estivadorio/traefik-certificate-extractor
ghcr.io/estivador/traefik-certificate-extractor
```
Mount the whole folder containing the traefik certificate file (`acme.json`) as `/app/data`. The extracted certificates are going to be written to `/app/certs`. Additionally this script will export combined key and cert into `combined.pem` file that can be used, i.e., for [Cockpit](https://cockpit-project.org) by correctly linking it to its certificate store.
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
watchdog
docker
watchdog==3.0.0
docker==6.1.3
2 changes: 1 addition & 1 deletion start_extractor.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ docker run --name extractor -d \
-v /opt/traefik:/app/data \
-v ${PWD}/certs:/app/certs \
-v /var/run/docker.socket:/var/run/docker.socket \
estivadorio/traefik-certificate-extractor
ghcr.io/estivador/traefik-certificate-extractor

0 comments on commit 4f9bee8

Please sign in to comment.