Skip to content

Commit 0f3feb1

Browse files
committed
Use gunicorn, add init CI/CD
1 parent 563ffa8 commit 0f3feb1

2 files changed

Lines changed: 58 additions & 2 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build Docker Image
2+
on:
3+
schedule:
4+
# Refresh monthly to pick up base image updates
5+
# Base image refreshes on the 1st, so run on the 2nd to capture upstream changes.
6+
- cron: '0 0 2 * *'
7+
push:
8+
branches:
9+
- main
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: anothrNick/github-tag-action@1.71.0
17+
id: bump_version
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
20+
DEFAULT_BUMP: patch
21+
WITH_V: true
22+
23+
- uses: docker/login-action@v3
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
27+
28+
- uses: docker/setup-qemu-action@v3
29+
30+
- uses: docker/setup-buildx-action@v3
31+
32+
- uses: docker/metadata-action@v5
33+
id: docker_meta
34+
with:
35+
images: |
36+
devdull/${{ github.event.repository.name }}
37+
tags: |
38+
# Tag branches with branch name, but disable for default branch
39+
type=ref,event=branch,enable=${{ github.ref_name != 'main' }}
40+
# set latest tag for default branch
41+
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
42+
# Always tag with the current version number
43+
type=raw,value=${{ steps.bump_version.outputs.new_tag }},enable=${{ github.ref_name == 'main' }}
44+
45+
- uses: docker/build-push-action@v5
46+
id: docker_build
47+
with:
48+
platforms: linux/amd64,linux/arm,linux/arm64
49+
push: ${{ github.repository_owner == 'dev-dull' }}
50+
tags: ${{ steps.docker_meta.outputs.tags }}
51+
labels: ${{ steps.docker_meta.outputs.labels }}

Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ COPY requirements.txt .
44
RUN pip install --user -r requirements.txt
55

66
FROM python:3-slim
7+
8+
ARG LISTEN_PORT=8000
9+
ENV LISTEN_PORT=${LISTEN_PORT}
10+
711
RUN mkdir /app
812
WORKDIR /app
13+
914
COPY --from=builder /root/.local /root/.local
1015
COPY ddb.py pyxie.py constfig.py config.yaml run.sh ./
1116
ENV PATH=/root/.local/bin:$PATH
12-
EXPOSE 8000
13-
# CMD ["python", "pyxie.py"]
17+
18+
EXPOSE ${LISTEN_PORT}
1419
CMD ["/app/run.sh"]

0 commit comments

Comments
 (0)