Skip to content

Commit 95d6f09

Browse files
feat: 🎉 initial commit
Signed-off-by: Mario Vejlupek <mario@vejlupek.cz>
1 parent 47a1227 commit 95d6f09

File tree

5 files changed

+91
-1
lines changed

5 files changed

+91
-1
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# NOTES:
2+
# 1. Create PAT with `read:packages` and `write:packages` see https://docs.github.com/en/free-pro-team@latest/packages/guides/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry
3+
# 2. Create CR_PAT variable under Settings / Secrets
4+
5+
name: BUILD
6+
7+
on:
8+
push:
9+
# Publish `v1.2.3` tags as releases.
10+
tags:
11+
- v*
12+
13+
env:
14+
FETCHER_IMAGE_VERSION: ""
15+
BASE_IMAGE_VERSION: ""
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Run build
25+
run: |
26+
IMAGE_NAME=ghcr.io/$(echo "${{ github.repository }}" | tr '[A-Z]' '[a-z]' )
27+
# Strip git ref prefix from version
28+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
29+
docker build . \
30+
--build-arg FETCHER_IMAGE_VERSION=${FETCHER_IMAGE_VERSION} \
31+
--build-arg BASE_IMAGE_VERSION=${BASE_IMAGE_VERSION} \
32+
--file Dockerfile --tag $IMAGE_NAME:$VERSION
33+
34+
- name: Log into GitHub Container Registry
35+
run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
36+
37+
- name: Push image to GitHub Container Registry
38+
run: |
39+
IMAGE_NAME=ghcr.io/$(echo "${{ github.repository }}" | tr '[A-Z]' '[a-z]' )
40+
# Strip git ref prefix from version
41+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
42+
echo IMAGE_NAME=$IMAGE_NAME
43+
echo VERSION=$VERSION
44+
docker push $IMAGE_NAME:$VERSION
45+
# Push latest as well for caching purposes
46+
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:latest
47+
docker push $IMAGE_NAME:latest

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# TODO:
2+
# 1. Create PAT with `read:packages` and `write:packages` see https://docs.github.com/en/free-pro-team@latest/packages/guides/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry
3+
# 2. Create CR_PAT variable under Settings / Secrets
4+
5+
name: TEST
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
env:
13+
FETCHER_IMAGE_VERSION: ""
14+
BASE_IMAGE_VERSION: ""
15+
16+
# NOTE: DO NOT CHANGE THIS THIS IS TMP IMAGE NAME
17+
IMAGE_NAME: image
18+
19+
jobs:
20+
test:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Run tests
27+
run: |
28+
docker build . \
29+
--build-arg FETCHER_IMAGE_VERSION=${FETCHER_IMAGE_VERSION} \
30+
--build-arg BASE_IMAGE_VERSION=${BASE_IMAGE_VERSION} \
31+
--file Dockerfile --tag $IMAGE_NAME

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM python:3.11.4-slim-bookworm
2+
3+
LABEL org.opencontainers.image.source https://github.com/Container-Driven-Development/Python-AWS-Exporter-Base
4+
5+
ENTRYPOINT ["/usr/local/bin/python"]
6+
7+
ADD requirements.txt /requirements.txt
8+
9+
CMD ["pip", "install", "--no-cache-dir", "-r", "/requirements.txt"]

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# Python-AWS-Exporter-Base
1+
# Python-AWS-Exporter-
2+
23
Base image for Python scripts exporting AWS resources using boto library to Prometheus

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
boto3==1.28.19
2+
prometheus_client==0.17.1

0 commit comments

Comments
 (0)