Skip to content

Commit 02b8bb9

Browse files
[exporters] deps: add docker image and publishing github action workflow
1 parent 6b06726 commit 02b8bb9

File tree

4 files changed

+653
-0
lines changed

4 files changed

+653
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Push garf-exporter to Github Packages
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'The semantic version to publish (1.0.0)'
8+
required: true
9+
type: string
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository_owner }}/garf-exporter
14+
jobs:
15+
build-and-push-image:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v3
24+
25+
- name: Log in to the Container registry
26+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
27+
with:
28+
registry: ${{ env.REGISTRY }}
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Extract metadata (tags, labels) for Docker
33+
id: meta
34+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
35+
with:
36+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37+
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
40+
with:
41+
context: libs/exporters/.
42+
push: true
43+
tags: ${{ github.event.inputs.version }}
44+
labels: ${{ github.event.inputs.version }}

libs/exporters/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3.12-alpine
2+
ENV PYTHONDONTWRITEBYTECODE=1
3+
RUN apk --no-cache add curl
4+
WORKDIR /app
5+
ADD requirements.txt .
6+
RUN pip install --require-hashes -r requirements.txt --no-deps
7+
ENV APP_PORT 8000
8+
ENTRYPOINT ["garf-exporter"]
9+
HEALTHCHECK --interval=1m \
10+
--timeout=10s \
11+
--retries=3 --start-period=2m \
12+
CMD curl -f http://localhost:$APP_PORT/health || exit 1

libs/exporters/requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
garf-exporter

0 commit comments

Comments
 (0)