Skip to content

Commit a1ee995

Browse files
committed
add dockerfile
1 parent b42c2d1 commit a1ee995

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

.github/workflows/docker.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Docker
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- "v*.*.*"
10+
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
steps:
15+
# https://docs.docker.com/build/ci/github-actions/manage-tags-labels/
16+
- name: Docker meta
17+
id: meta
18+
uses: docker/metadata-action@v5
19+
with:
20+
images: |
21+
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
22+
flavor: |
23+
latest=auto
24+
tags: |
25+
type=schedule
26+
type=ref,event=branch
27+
type=ref,event=pr
28+
type=semver,pattern={{version}}
29+
type=semver,pattern={{major}}.{{minor}}
30+
type=semver,pattern={{major}}
31+
type=sha
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
- name: Login to Docker Hub
37+
uses: docker/login-action@v3
38+
with:
39+
username: ${{ secrets.DOCKERHUB_USERNAME }}
40+
password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
- name: Build and push
42+
uses: docker/build-push-action@v6
43+
with:
44+
push: ${{ github.event_name != 'pull_request' }}
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# https://docs.astral.sh/uv/guides/integration/docker/#non-editable-installs
2+
ARG PYTHON_VERSION=3.12
3+
ARG DEBIAN_VERSION=bookworm
4+
FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-${DEBIAN_VERSION}-slim AS uv
5+
6+
WORKDIR /app
7+
8+
ENV UV_COMPILE_BYTECODE=1
9+
ENV UV_LINK_MODE=copy
10+
11+
RUN --mount=type=cache,target=/root/.cache/uv \
12+
--mount=type=bind,source=uv.lock,target=uv.lock \
13+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
14+
uv sync --frozen --no-install-project --no-dev --no-editable
15+
16+
ADD . /app
17+
RUN --mount=type=cache,target=/root/.cache/uv \
18+
uv sync --frozen --no-dev --no-editable
19+
20+
FROM python:${PYTHON_VERSION}-slim-${DEBIAN_VERSION}
21+
22+
WORKDIR /app
23+
24+
COPY --from=uv --chown=app:app /app/.venv /app/.venv
25+
26+
ENV PATH="/app/.venv/bin:$PATH"
27+
28+
ENTRYPOINT ["mcpservertemplate"]

0 commit comments

Comments
 (0)