mirror of
https://github.com/aimingmed/aimingmed-ai.git
synced 2026-02-08 16:37:29 +08:00
updated
This commit is contained in:
parent
02bdc94f33
commit
9c89b63d67
8
.github/workflows/build_new.yml
vendored
8
.github/workflows/build_new.yml
vendored
@ -73,17 +73,17 @@ jobs:
|
|||||||
testContainerName: tests-aimingmedai
|
testContainerName: tests-aimingmedai
|
||||||
# Pass test environment variables as JSON string
|
# Pass test environment variables as JSON string
|
||||||
testEnvs: >
|
testEnvs: >
|
||||||
[
|
'[
|
||||||
"FRONTEND_URL=http://frontend:80",
|
"FRONTEND_URL=http://frontend:80",
|
||||||
"BACKEND_URL=http://backend:80",
|
"BACKEND_URL=http://backend:80",
|
||||||
"ENVIRONMENT=dev",
|
"ENVIRONMENT=dev",
|
||||||
"TESTING=1",
|
"TESTING=1",
|
||||||
]
|
]'
|
||||||
# Pass test directories as JSON string
|
# Pass test directories as JSON string
|
||||||
tests: >
|
tests: >
|
||||||
[
|
'[
|
||||||
"tests/integration/backend",
|
"tests/integration/backend",
|
||||||
]
|
]'
|
||||||
# Pass image definitions for compose setup as JSON string
|
# Pass image definitions for compose setup as JSON string
|
||||||
# Sensitive values should be passed via secrets and referenced within the template
|
# Sensitive values should be passed via secrets and referenced within the template
|
||||||
images: >
|
images: >
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# pull official base image
|
# pull official base image
|
||||||
FROM python:3.11-slim-bullseye AS base
|
FROM python:3.11-slim-bullseye
|
||||||
|
|
||||||
# create directory for the app user
|
# create directory for the app user
|
||||||
RUN mkdir -p /home/app
|
RUN mkdir -p /home/app
|
||||||
@ -16,13 +16,15 @@ WORKDIR $APP_HOME
|
|||||||
# set environment variables
|
# set environment variables
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
ENV ENVIRONMENT=dev
|
||||||
|
ENV TESTING=1
|
||||||
|
|
||||||
# add app
|
# add app
|
||||||
COPY . $APP_HOME
|
COPY . $APP_HOME
|
||||||
|
|
||||||
# install python dependencies
|
# install python dependencies
|
||||||
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv && rm -rf ~/.cache/pip
|
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv && rm -rf ~/.cache/pip
|
||||||
RUN pipenv install --deploy
|
RUN pipenv install --deploy --dev
|
||||||
|
|
||||||
# chown all the files to the app user
|
# chown all the files to the app user
|
||||||
RUN chown -R app:app $APP_HOME
|
RUN chown -R app:app $APP_HOME
|
||||||
@ -30,26 +32,10 @@ RUN chown -R app:app $APP_HOME
|
|||||||
# change to the app user
|
# change to the app user
|
||||||
USER app
|
USER app
|
||||||
|
|
||||||
|
# pytest
|
||||||
|
|
||||||
# TEST
|
|
||||||
FROM base AS test
|
|
||||||
|
|
||||||
ENV ENVIRONMENT=dev
|
|
||||||
ENV TESTING=1
|
|
||||||
|
|
||||||
RUN pipenv install --deploy --dev
|
|
||||||
|
|
||||||
# run tests
|
|
||||||
RUN pipenv run pytest tests --disable-warnings
|
RUN pipenv run pytest tests --disable-warnings
|
||||||
|
|
||||||
|
|
||||||
# BUILD
|
|
||||||
FROM base AS builder
|
|
||||||
|
|
||||||
ENV ENVIRONMENT=prod
|
|
||||||
ENV TESTING=0
|
|
||||||
|
|
||||||
# expose the port the app runs on
|
# expose the port the app runs on
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
# pull official base image
|
# pull official base image
|
||||||
FROM python:3.11-slim-bookworm AS builder
|
FROM python:3.11-slim-bookworm AS builder
|
||||||
|
|
||||||
|
|
||||||
# set working directory
|
# set working directory
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
@ -13,11 +12,6 @@ WORKDIR /usr/src/app
|
|||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# install system dependencies
|
|
||||||
# RUN apt-get update && apt-get -y install build-essential \
|
|
||||||
# && apt-get clean \
|
|
||||||
# && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# install python dependencies
|
# install python dependencies
|
||||||
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv && rm -rf ~/.cache/pip
|
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv && rm -rf ~/.cache/pip
|
||||||
COPY ./Pipfile .
|
COPY ./Pipfile .
|
||||||
@ -25,6 +19,7 @@ RUN pipenv install --deploy --dev
|
|||||||
|
|
||||||
# add app
|
# add app
|
||||||
COPY . /usr/src/app
|
COPY . /usr/src/app
|
||||||
|
RUN pipenv run pytest tests --disable-warnings
|
||||||
# RUN pipenv run pip install black==23.12.1 flake8==7.0.0 isort==5.13.2
|
# RUN pipenv run pip install black==23.12.1 flake8==7.0.0 isort==5.13.2
|
||||||
# RUN pipenv run flake8 .
|
# RUN pipenv run flake8 .
|
||||||
# RUN pipenv run black --exclude=migrations . --check
|
# RUN pipenv run black --exclude=migrations . --check
|
||||||
@ -58,9 +53,8 @@ ENV TESTING=0
|
|||||||
|
|
||||||
|
|
||||||
# install python dependencies
|
# install python dependencies
|
||||||
COPY --from=builder /usr/src/app/Pipfile .
|
|
||||||
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv && rm -rf ~/.cache/pip
|
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv && rm -rf ~/.cache/pip
|
||||||
RUN pipenv install --deploy --dev
|
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
|
||||||
@ -73,7 +67,7 @@ RUN chown -R app:app $APP_HOME
|
|||||||
USER app
|
USER app
|
||||||
|
|
||||||
# expose the port the app runs on
|
# expose the port the app runs on
|
||||||
EXPOSE 8765
|
EXPOSE 80
|
||||||
|
|
||||||
# run uvicorn
|
# run uvicorn
|
||||||
CMD ["pipenv", "run", "uvicorn", "main:app", "--reload", "--workers", "1", "--host", "0.0.0.0", "--port", "80"]
|
CMD ["pipenv", "run", "uvicorn", "main:app", "--reload", "--workers", "1", "--host", "0.0.0.0", "--port", "80"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user