mirror of
https://github.com/aimingmed/aimingmed-ai.git
synced 2026-02-01 20:23:34 +08:00
try
This commit is contained in:
parent
0a79654728
commit
3bd2ecbafc
7
.github/workflows/template_test.yml
vendored
7
.github/workflows/template_test.yml
vendored
@ -156,9 +156,10 @@ jobs:
|
|||||||
ENV_ARGS=""
|
ENV_ARGS=""
|
||||||
if [[ "$TEST_ENVS_JSON" != "[]" ]]; then
|
if [[ "$TEST_ENVS_JSON" != "[]" ]]; then
|
||||||
# Convert JSON array string to individual env vars
|
# Convert JSON array string to individual env vars
|
||||||
while IFS= read -r line; do
|
IFS=',' read -r -a env_array <<< $(echo "$TEST_ENVS_JSON" | jq -r '.[][]')
|
||||||
ENV_ARGS+=" -e \"$line\""
|
for env in "${env_array[@]}"; do
|
||||||
done <<< $(echo "$TEST_ENVS_JSON" | jq -r '.[]')
|
ENV_ARGS+=" -e \"$env\""
|
||||||
|
done
|
||||||
else
|
else
|
||||||
# Add a dummy env var if none are provided, as required by original script logic
|
# Add a dummy env var if none are provided, as required by original script logic
|
||||||
ENV_ARGS+=" -e DUMMY_ENV_TEST_RUN_ID=${{ github.run_id }}"
|
ENV_ARGS+=" -e DUMMY_ENV_TEST_RUN_ID=${{ github.run_id }}"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# pull official base image
|
# pull official base image
|
||||||
FROM python:3.11-slim-bullseye
|
FROM python:3.11-slim-bullseye AS base
|
||||||
|
|
||||||
# create directory for the app user
|
# create directory for the app user
|
||||||
RUN mkdir -p /home/app
|
RUN mkdir -p /home/app
|
||||||
@ -16,16 +16,13 @@ WORKDIR $APP_HOME
|
|||||||
# set environment variables
|
# set environment variables
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
ENV ENVIRONMENT=prod
|
|
||||||
ENV TESTING=0
|
|
||||||
|
|
||||||
|
|
||||||
# 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 --dev
|
RUN pipenv install --deploy
|
||||||
|
|
||||||
# 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
|
||||||
@ -33,6 +30,27 @@ RUN chown -R app:app $APP_HOME
|
|||||||
# change to the app user
|
# change to the app user
|
||||||
USER app
|
USER app
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user