Skip to content

Commit 193883a

Browse files
Add Dockerfile and workflow
1 parent 78fd5e9 commit 193883a

File tree

4 files changed

+59
-39
lines changed

4 files changed

+59
-39
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- 'release/**'
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Log in to the Container registry
24+
uses: docker/login-action@v2
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Extract metadata (tags, labels) for Docker
31+
id: meta
32+
uses: docker/metadata-action@v4
33+
with:
34+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35+
tags: |
36+
type=ref,event=branch
37+
type=sha
38+
39+
- name: Build and push Docker image
40+
uses: docker/build-push-action@v4
41+
with:
42+
context: .
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM python:3.12-slim
2+
3+
WORKDIR /app
4+
5+
COPY ./poetry.lock /app
6+
COPY ./pyproject.toml /app
7+
8+
RUN pip install poetry
9+
RUN poetry install
10+
11+
COPY ./openai_api_server_mock /app/openai_api_server_mock
12+
13+
CMD ["poetry", "run", "fastapi", "run", "openai_api_server_mock/main.py", "--port", "8000"]

openai_api_server_mock/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional, Literal
1+
from typing import Literal
22
from pydantic import Field
33
from pydantic_settings import BaseSettings
44

pyproject_old.toml

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)