Skip to content

Commit

Permalink
Add Dockerfile and workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hummerichsander authored Sep 25, 2024
1 parent 78fd5e9 commit 193883a
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 39 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/publish_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish Docker image

on:
push:
branches:
- 'release/**'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.12-slim

WORKDIR /app

COPY ./poetry.lock /app
COPY ./pyproject.toml /app

RUN pip install poetry
RUN poetry install

COPY ./openai_api_server_mock /app/openai_api_server_mock

CMD ["poetry", "run", "fastapi", "run", "openai_api_server_mock/main.py", "--port", "8000"]
2 changes: 1 addition & 1 deletion openai_api_server_mock/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, Literal
from typing import Literal
from pydantic import Field
from pydantic_settings import BaseSettings

Expand Down
38 changes: 0 additions & 38 deletions pyproject_old.toml

This file was deleted.

0 comments on commit 193883a

Please sign in to comment.