self-hosted

This commit is contained in:
leehk 2025-04-11 19:07:22 +08:00
parent eed89dced3
commit 2506690ad1
2 changed files with 4 additions and 5 deletions

View File

@ -12,7 +12,7 @@ jobs:
build: build:
name: Build Docker Image name: Build Docker Image
runs-on: ubuntu-latest runs-on: self-hosted
permissions: permissions:
contents: read contents: read
packages: write packages: write
@ -41,7 +41,7 @@ jobs:
test: test:
name: Test Docker Image name: Test Docker Image
runs-on: ubuntu-latest runs-on: self-hosted
needs: build needs: build
steps: steps:
- name: Checkout - name: Checkout

View File

@ -23,7 +23,7 @@ RUN pip install --upgrade pip setuptools wheel -i https://pypi.tuna.tsinghua.edu
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv
RUN pip install --no-cache-dir --find-links=/usr/src/app/wheels pipenv RUN pip install --no-cache-dir --find-links=/usr/src/app/wheels pipenv
COPY ./Pipfile . COPY ./Pipfile .
RUN pipenv lock --pre && pipenv install --deploy RUN pipenv install --deploy
# add app # add app
COPY . /usr/src/app COPY . /usr/src/app
@ -68,7 +68,7 @@ COPY --from=builder /usr/src/app/wheels /wheels
COPY --from=builder /usr/src/app/Pipfile . COPY --from=builder /usr/src/app/Pipfile .
RUN pip install --upgrade pip setuptools wheel -i https://pypi.tuna.tsinghua.edu.cn/simple RUN pip install --upgrade pip setuptools wheel -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install --no-cache /wheels/* RUN pip install --no-cache /wheels/*
RUN pipenv lock --pre && pipenv install --deploy RUN pipenv install --deploy
RUN pipenv run pip install "uvicorn[standard]==0.26.0" RUN pipenv run pip install "uvicorn[standard]==0.26.0"
# add app # add app
@ -80,6 +80,5 @@ RUN chown -R app:app $APP_HOME
# change to the app user # change to the app user
USER app USER app
# run gunicorn # run gunicorn
CMD pipenv run gunicorn --bind 0.0.0.0:$PORT backend.main:app -k uvicorn.workers.UvicornWorker CMD pipenv run gunicorn --bind 0.0.0.0:$PORT backend.main:app -k uvicorn.workers.UvicornWorker