Skip to content

Commit 67b9074

Browse files
committed
chore: Add Dockerfile and GitHub Actions workflow for building and publishing base image
1 parent 73090c8 commit 67b9074

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Docker Build and Publish Base Image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
DOCKER_HUB_USERNAME: ifuryst
8+
ALIYUN_REGISTRY: registry.ap-southeast-1.aliyuncs.com/mcp-ecosystem
9+
BUILDX_NO_DEFAULT_ATTESTATIONS: 1
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
with:
25+
platforms: linux/amd64,linux/arm64
26+
27+
- name: Login to Docker Hub
28+
uses: docker/login-action@v3
29+
with:
30+
username: ${{ env.DOCKER_HUB_USERNAME }}
31+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
32+
33+
- name: Login to GitHub Container Registry
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Login to Aliyun Container Registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: ${{ env.ALIYUN_REGISTRY }}
44+
username: ${{ secrets.ALIYUN_USERNAME }}
45+
password: ${{ secrets.ALIYUN_PASSWORD }}
46+
47+
- name: Build and push base image
48+
uses: docker/build-push-action@v5
49+
with:
50+
context: .
51+
file: deploy/docker/base/Dockerfile
52+
push: true
53+
platforms: linux/amd64,linux/arm64
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
56+
build-args: |
57+
PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
58+
UV_DEFAULT_INDEX=https://mirrors.aliyun.com/pypi/simple/
59+
npm_config_registry=https://registry.npmmirror.com
60+
tags: |
61+
${{ env.DOCKER_HUB_USERNAME }}/mcp-gateway-base:latest
62+
ghcr.io/${{ github.repository }}/base:latest
63+
${{ env.ALIYUN_REGISTRY }}/mcp-gateway-base:latest

deploy/docker/base/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM ubuntu:22.04
2+
3+
ENV TZ=UTC
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
RUN apt-get update && apt-get install -y --no-install-recommends \
7+
ca-certificates \
8+
curl \
9+
gnupg \
10+
supervisor \
11+
nginx \
12+
tzdata \
13+
vim \
14+
python3 \
15+
python3-pip \
16+
python3-venv && \
17+
ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \
18+
echo ${TZ} > /etc/timezone && \
19+
dpkg-reconfigure -f noninteractive tzdata
20+
21+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
22+
apt-get update && apt-get install -y nodejs && \
23+
npm install -g npm@latest
24+
25+
RUN python3 -m pip install --no-cache-dir uv
26+
27+
RUN apt-get clean && rm -rf \
28+
/var/lib/apt/lists/* \
29+
/tmp/* /var/tmp/* \
30+
/usr/share/doc /usr/share/man /usr/share/info /usr/share/lintian /usr/share/locale
31+
32+
WORKDIR /app
33+
34+
CMD ["bash"]

0 commit comments

Comments
 (0)