Skip to content

Commit ddd8622

Browse files
committed
docker image publish
1 parent 590f407 commit ddd8622

File tree

4 files changed

+98
-3
lines changed

4 files changed

+98
-3
lines changed

.github/workflows/publish_docker.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: perfSONAR Lookup Server Image
2+
3+
# This action builds Docker images then
4+
# pushes result to GitHub Container Registry.
5+
6+
on:
7+
push:
8+
branches: [ '*' ]
9+
# Publish semver tags as releases.
10+
tags: [ 'v*.*.*' ]
11+
pull_request:
12+
branches: [ 'main' ]
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
# github.repository as <account>/<repo>
17+
IMAGE_BASE: ${{ github.repository }}
18+
BUILD_DIR: .
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
packages: write
26+
# This is used to complete the identity challenge
27+
# with sigstore/fulcio when running outside of PRs.
28+
id-token: write
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v3
33+
34+
- name: Set up QEMU
35+
uses: docker/setup-qemu-action@v2
36+
37+
- name: Setup Docker buildx
38+
uses: docker/setup-buildx-action@v2
39+
40+
# Login against a Docker registry except on PR
41+
# https://github.com/docker/login-action
42+
- name: Log into registry ${{ env.REGISTRY }}
43+
if: github.event_name != 'pull_request'
44+
uses: docker/login-action@v2
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
# Extract metadata (tags, labels) for Docker
51+
# https://github.com/docker/metadata-action
52+
- name: Extract Docker metadata
53+
id: meta
54+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
55+
with:
56+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}
57+
tags: |
58+
type=schedule
59+
type=ref,event=branch
60+
type=ref,event=tag
61+
type=ref,event=pr
62+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
63+
64+
# Build and push Docker image with Buildx (don't push on PR)
65+
# https://github.com/docker/build-push-action
66+
- name: Build and push Docker images
67+
id: build-and-push
68+
uses: docker/build-push-action@v3
69+
with:
70+
context: ${{ env.BUILD_DIR }}
71+
file: ${{ env.BUILD_DIR }}/Dockerfile
72+
push: ${{ github.event_name != 'pull_request' }}
73+
tags: ${{ steps.meta.outputs.tags }}
74+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@ schema/__pycache__
55
schema/model.py
66
schema/__init__.py
77
tests/
8-
Dockerfile
9-
http_ca.crt
10-
Dockerfile
8+
http_ca.crt

Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3
2+
3+
WORKDIR /usr/src/app
4+
5+
COPY requirements.txt ./
6+
RUN pip install --no-cache-dir -r requirements.txt
7+
8+
COPY . .
9+
10+
EXPOSE 8000
11+
12+
CMD ["fastapi", "run", "app/main.py", "--port", "8000"]

requirements.txt

+11
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1+
elasticsearch
2+
fastapi
3+
fastapi-cli
4+
jsonschema
15
opensearch-py
6+
opentelemetry-api
7+
opentelemetry-sdk
8+
opentelemetry-instrumentation
9+
opentelemetry-instrumentation-fastapi
10+
opentelemetry-instrumentation-elasticsearch
11+
slowapi
12+
uvicorn

0 commit comments

Comments
 (0)