Update Build

This commit is contained in:
dx-tan 2023-12-26 14:10:59 +07:00
parent a59d4c51f4
commit d3708468b0
6 changed files with 31 additions and 26 deletions

View File

@ -48,12 +48,12 @@ RUN cd /workspace/cope2n-ai-fi/modules/ocr_engine/externals/sdsvtr && pip3 insta
RUN cd /workspace/cope2n-ai-fi/modules/sdsvkvu && pip3 install -v -e . --no-cache-dir RUN cd /workspace/cope2n-ai-fi/modules/sdsvkvu && pip3 install -v -e . --no-cache-dir
RUN cd /workspace/cope2n-ai-fi && pip3 install -r requirements.txt --no-cache-dir RUN cd /workspace/cope2n-ai-fi && pip3 install -r requirements.txt --no-cache-dir
RUN rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \ # RUN rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \
rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \ # rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \
rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11 && \ # rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11 && \
ln -s /opt/conda/lib/libcublasLt.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \ # ln -s /opt/conda/lib/libcublasLt.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \
ln -s /opt/conda/lib/libcublas.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \ # ln -s /opt/conda/lib/libcublas.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \
ln -s /opt/conda/lib/libnvblas.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11 # ln -s /opt/conda/lib/libnvblas.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11
WORKDIR /workspace WORKDIR /workspace

View File

@ -10,4 +10,5 @@ easydict
imagesize==1.4.1 imagesize==1.4.1
pdf2image==1.16.3 pdf2image==1.16.3
redis==5.0.1 redis==5.0.1
celery==5.3.6

View File

@ -8,8 +8,8 @@ from datetime import datetime
BASH_FILE = './deploy_images.sh' BASH_FILE = './deploy_images.sh'
S3_ENDPOINT = "" S3_ENDPOINT = ""
S3_ACCESS_KEY = "AKIA3AFPFVWZD77UACHE" S3_ACCESS_KEY = "secret"
S3_SECRET_KEY = "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" S3_SECRET_KEY = "secret"
S3_BUCKET = "ocr-deployment-config" S3_BUCKET = "ocr-deployment-config"
class MinioS3Client: class MinioS3Client:
@ -77,7 +77,8 @@ def deploy():
# Define the variable # Define the variable
tag = str(random_hash()[:8]) tag = str(random_hash()[:8])
now = datetime.now() now = datetime.now()
tag = tag + "_" + str(now.strftime("%d%m%y%H%M%S")) # tag = tag + "_" + str(now.strftime("%d%m%y%H%M%S"))
tag = "4cae5134_261223123256"
print(tag) print(tag)
# Execute the Bash script with the variable as a command-line argument # Execute the Bash script with the variable as a command-line argument

View File

@ -1,23 +1,24 @@
#!/bin/bash #!/bin/bash
set -e
tag=$1 tag=$1
echo "[INFO] Tag received from Python: $tag" echo "[INFO] Tag received from Python: $tag"
echo "[INFO] Pushing AI image with tag: $tag..." # echo "[INFO] Pushing AI image with tag: $tag..."
docker compose -f docker-compose-dev.yml build cope2n-fi-sbt # docker compose -f docker-compose-dev.yml build cope2n-fi-sbt
docker tag sidp/cope2n-ai-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-ai-fi-sbt:${tag} # docker tag sidp/cope2n-ai-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-ai-fi-sbt:${tag}
docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-ai-fi-sbt:${tag} # docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-ai-fi-sbt:${tag}
echo "[INFO] Pushing BE image with tag: $tag..." # echo "[INFO] Pushing BE image with tag: $tag..."
docker compose -f docker-compose-dev.yml build be-ctel-sbt # docker compose -f docker-compose-dev.yml build be-ctel-sbt
docker tag sidp/cope2n-be-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:${tag} # docker tag sidp/cope2n-be-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:${tag}
docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:${tag} # docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:${tag}
echo "[INFO] Pushing FE image with tag: $tag..." # echo "[INFO] Pushing FE image with tag: $tag..."
docker compose -f docker-compose-dev.yml build fe-sbt # docker compose -f docker-compose-dev.yml build fe-sbt
docker tag sidp/cope2n-fe-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-fe-fi-sbt:${tag} # docker tag sidp/cope2n-fe-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-fe-fi-sbt:${tag}
docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-fe-fi-sbt:${tag} # docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-fe-fi-sbt:${tag}
cp ./docker-compose-prod.yml ./docker-compose_${tag}.yml cp ./docker-compose-prod.yml ./docker-compose_${tag}.yml
sed -i "s/{{tag}}/$tag/g" ./docker-compose_${tag}.yml sed -i "s/{{tag}}/$tag/g" ./docker-compose_${tag}.yml

View File

@ -173,7 +173,7 @@ services:
db-sbt: db-sbt:
restart: always restart: always
mem_reservation: 500m mem_reservation: 500m
image: postgres:14.7-alpine image: postgres:15.4-alpine
volumes: volumes:
- ./data/postgres_data:/var/lib/postgresql/data - ./data/postgres_data:/var/lib/postgresql/data
networks: networks:

View File

@ -51,15 +51,16 @@ services:
- S3_SECRET_KEY=${S3_SECRET_KEY} - S3_SECRET_KEY=${S3_SECRET_KEY}
- S3_BUCKET_NAME=${S3_BUCKET_NAME} - S3_BUCKET_NAME=${S3_BUCKET_NAME}
restart: always restart: always
privileged: true # for chmod
mem_limit: 10gb mem_limit: 10gb
image: public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:{{tag}} image: public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:{{tag}}
networks: networks:
- ctel-sbt - ctel-sbt
volumes: volumes:
- ${HOST_MEDIA_FOLDER}:${MEDIA_ROOT} - BE_media:${MEDIA_ROOT}
- BE_static:/app/static - BE_static:/app/static
working_dir: /app working_dir: /app
command: sh -c "chmod -R 777 /app/static; sleep 5; python manage.py collectstatic --no-input && command: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input &&
python manage.py migrate && python manage.py migrate &&
python manage.py compilemessages && python manage.py compilemessages &&
gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod
@ -135,7 +136,7 @@ services:
rabbitmq-sbt: rabbitmq-sbt:
condition: service_started condition: service_started
volumes: volumes:
- ${HOST_MEDIA_FOLDER}:${MEDIA_ROOT} - BE_media:${MEDIA_ROOT}
working_dir: /app working_dir: /app
command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5" command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5"
@ -191,3 +192,4 @@ services:
volumes: volumes:
db_data: db_data:
BE_static: BE_static:
BE_media: