dev - fix docker build

This commit is contained in:
slatinsky 2024-08-12 01:00:45 +02:00
parent 415689e26c
commit 38f9460cd0
3 changed files with 11 additions and 38 deletions

View file

@ -3,8 +3,9 @@
# ----------------------
# build sveltekit static app
FROM node:19.2.0-alpine3.15 as build
WORKDIR /app
FROM node:22.6.0-alpine3.19 as build
RUN mkdir -p /app/dcef/frontend
WORKDIR /app/dcef/frontend
COPY src/dcef/frontend/package.json src/dcef/frontend/package-lock.json ./
RUN npm install
COPY src/dcef/frontend/ .
@ -17,19 +18,19 @@ RUN apt-get update && apt-get install python3.11 python3-pip nginx wget -y
RUN mkdir -p /dcef/exports/
COPY release/exports/ /dcef/exports/
COPY src/dcef/backend/preprocess/requirements.txt /dcef/backend/preprocess/requirements.txt
COPY src/dcef/fastapi/requirements.txt /dcef/backend/fastapi/requirements.txt
COPY src/dcef/backend/fastapi/requirements.txt /dcef/backend/fastapi/requirements.txt
COPY src/dcef/backend/configurator/requirements.txt /dcef/backend/configurator/requirements.txt
RUN python3.11 -m pip install -r ./src/dcef/backend/preprocess/requirements.txt
RUN python3.11 -m pip install -r ./src/dcef/backend/fastapi/requirements.txt
RUN python3.11 -m pip install -r ./src/dcef//backend/configurator/requirements.txt
RUN python3.11 -m pip install -r /dcef/backend/preprocess/requirements.txt
RUN python3.11 -m pip install -r /dcef/backend/fastapi/requirements.txt
RUN python3.11 -m pip install -r /dcef/backend/configurator/requirements.txt
RUN mkdir -p /dcef/backend/nginx/logs/
COPY src/dcef/backend/nginx/conf/mime.types /dcef/backend/nginx/conf/mime.types
COPY src/dcef/backend/nginx/conf/nginx-docker.conf /dcef/backend/nginx/conf/nginx-docker.conf
COPY --from=build /app/build/ ./frontend/
COPY --from=build /app/_temp/frontend/ ./frontend/
COPY src/dcef/backend/preprocess/ ./backend/preprocess/
COPY src/dcef/backend/fastapi/ ./backend/fastapi/
COPY src/dcef/backend/configurator/main.py ./configurator.py
COPY src/dcef/backend/docker/run_container.sh ./run_container.sh
RUN chmod 777 /dcef/run_container.sh
EXPOSE 21011
CMD dcef/run_container.sh
CMD /dcef/run_container.sh

View file

@ -3,9 +3,9 @@ mkdir -p /dcef/cache/preprocess
mkdir -p /dcef/cache/db
mongod --dbpath "/dcef/cache/db/" --wiredTigerCacheSizeGB 1.5 &
cd /dcef/backend/preprocess
python3.11 main_mongo.py ../../exports/ ../../cache/preprocess/
python3.11 main_mongo.py
cd /dcef/backend/fastapi
python3.11 -m uvicorn app:app --host "0.0.0.0" --port 58000 --workers 1 &
python3.11 prod.py &
echo "############################################################"
echo "# Open http://127.0.0.1:21011/ in your browser to view GUI #"
echo "############################################################"

View file

@ -39,22 +39,6 @@ http {
# disable directory listing, because it requires execute permission
autoindex off;
location /_app/ {
root /dcef/frontend/;
}
location /css/ {
root /dcef/frontend/;
}
location /js/ {
root /dcef/frontend/;
}
location /fonts/ {
root /dcef/frontend/;
# cache
expires 7d;
add_header Cache-Control "public, max-age=604800, immutable";
}
location /input/ {
alias /dcef/exports/;
@ -62,9 +46,6 @@ http {
expires 7d;
add_header Cache-Control "public, max-age=604800, immutable";
}
location /data/ {
alias /dcef/cache/preprocess/;
}
location /api/ {
rewrite ^/api/(.*) /$1 break;
proxy_pass http://127.0.0.1:58000/;
@ -72,17 +53,8 @@ http {
proxy_set_header Host $http_host;
proxy_http_version 1.1;
}
location /favicon.png {
alias /dcef/frontend/favicon.png;
# cache
expires 7d;
add_header Cache-Control "public, max-age=604800, immutable";
}
location / {
root /dcef/frontend/;
try_files /index.html /index.htm =418;
}
}
}