mirror of
https://github.com/aimingmed/aimingmed-ai.git
synced 2026-01-19 13:23:23 +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
|
||||
# Pass test environment variables as JSON string
|
||||
testEnvs: >
|
||||
[
|
||||
'[
|
||||
"FRONTEND_URL=http://frontend:80",
|
||||
"BACKEND_URL=http://backend:80",
|
||||
"ENVIRONMENT=dev",
|
||||
"TESTING=1",
|
||||
]
|
||||
]'
|
||||
# Pass test directories as JSON string
|
||||
tests: >
|
||||
[
|
||||
'[
|
||||
"tests/integration/backend",
|
||||
]
|
||||
]'
|
||||
# Pass image definitions for compose setup as JSON string
|
||||
# Sensitive values should be passed via secrets and referenced within the template
|
||||
images: >
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# pull official base image
|
||||
FROM python:3.11-slim-bullseye AS base
|
||||
FROM python:3.11-slim-bullseye
|
||||
|
||||
# create directory for the app user
|
||||
RUN mkdir -p /home/app
|
||||
@ -16,13 +16,15 @@ WORKDIR $APP_HOME
|
||||
# set environment variables
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV ENVIRONMENT=dev
|
||||
ENV TESTING=1
|
||||
|
||||
# add app
|
||||
COPY . $APP_HOME
|
||||
|
||||
# install python dependencies
|
||||
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
|
||||
RUN chown -R app:app $APP_HOME
|
||||
@ -30,26 +32,10 @@ RUN chown -R app:app $APP_HOME
|
||||
# change to the app user
|
||||
USER app
|
||||
|
||||
|
||||
|
||||
# TEST
|
||||
FROM base AS test
|
||||
|
||||
ENV ENVIRONMENT=dev
|
||||
ENV TESTING=1
|
||||
|
||||
RUN pipenv install --deploy --dev
|
||||
|
||||
# run tests
|
||||
# pytest
|
||||
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 80
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
# pull official base image
|
||||
FROM python:3.11-slim-bookworm AS builder
|
||||
|
||||
|
||||
# set working directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
@ -13,11 +12,6 @@ WORKDIR /usr/src/app
|
||||
ENV PYTHONDONTWRITEBYTECODE=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
|
||||
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv && rm -rf ~/.cache/pip
|
||||
COPY ./Pipfile .
|
||||
@ -25,6 +19,7 @@ RUN pipenv install --deploy --dev
|
||||
|
||||
# add 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 flake8 .
|
||||
# RUN pipenv run black --exclude=migrations . --check
|
||||
@ -58,9 +53,8 @@ ENV TESTING=0
|
||||
|
||||
|
||||
# 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 pipenv install --deploy --dev
|
||||
RUN pipenv install --deploy
|
||||
RUN pipenv run pip install "uvicorn[standard]==0.26.0"
|
||||
|
||||
# add app
|
||||
@ -73,7 +67,7 @@ RUN chown -R app:app $APP_HOME
|
||||
USER app
|
||||
|
||||
# expose the port the app runs on
|
||||
EXPOSE 8765
|
||||
EXPOSE 80
|
||||
|
||||
# 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