Changed the running command of the Docker container.
This commit is contained in:
@@ -27,7 +27,10 @@ RUN pip install --no-cache-dir -r files/requirements.txt
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
RUN rm files/db.sqlite -f
|
||||||
|
|
||||||
RUN /usr/local/bin/alembic -c alembic/alembic.ini upgrade head
|
RUN /usr/local/bin/alembic -c alembic/alembic.ini upgrade head
|
||||||
|
|
||||||
# Command to run the FastAPI application
|
# Command to run the FastAPI application
|
||||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|
# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||||
|
CMD ["bash", "/app/scripts/run.sh"]
|
||||||
@@ -37,7 +37,7 @@ mkdir -p ~/.db-middleware/scripts &&
|
|||||||
rm -rf ~/.db-middleware/scripts/* &&
|
rm -rf ~/.db-middleware/scripts/* &&
|
||||||
cd ~/.db-middleware/scripts &&
|
cd ~/.db-middleware/scripts &&
|
||||||
wget -qO setup.sh https://gitea.abdulhade.com/abdulhade/db-middleware/raw/branch/main/scripts/setup.sh &&
|
wget -qO setup.sh https://gitea.abdulhade.com/abdulhade/db-middleware/raw/branch/main/scripts/setup.sh &&
|
||||||
sudo bash setup.sh
|
bash setup.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -230,9 +230,9 @@ load_config() {
|
|||||||
get_run_command() {
|
get_run_command() {
|
||||||
local RUN_COMMAND="docker run -d --name $CONTAINER_NAME"
|
local RUN_COMMAND="docker run -d --name $CONTAINER_NAME"
|
||||||
if [[ $HAS_LOCAL_DBS -eq 1 || $HAS_LOCAL_DBS == "1" ]]; then
|
if [[ $HAS_LOCAL_DBS -eq 1 || $HAS_LOCAL_DBS == "1" ]]; then
|
||||||
RUN_COMMAND+=" --network host"
|
RUN_COMMAND+=" --env API_HOST=localhost --env API_PORT=${API_PORT:-8080} --network host"
|
||||||
else
|
else
|
||||||
RUN_COMMAND+=" -p ${API_PORT:-8080}:8080"
|
RUN_COMMAND+=" --env API_HOST=0.0.0.0 --env API_PORT=${API_PORT:-8080} -p ${API_PORT:-8080}:8080"
|
||||||
fi
|
fi
|
||||||
RUN_COMMAND+=" $IMAGE_NAME"
|
RUN_COMMAND+=" $IMAGE_NAME"
|
||||||
echo $RUN_COMMAND
|
echo $RUN_COMMAND
|
||||||
@@ -664,6 +664,7 @@ main() {
|
|||||||
restart) restart;;
|
restart) restart;;
|
||||||
status) status ;;
|
status) status ;;
|
||||||
show_config) show_config ;;
|
show_config) show_config ;;
|
||||||
|
update_config) update_config;;
|
||||||
stop) stop ;;
|
stop) stop ;;
|
||||||
*) echo "Invalid argument: $1"; usage ;;
|
*) echo "Invalid argument: $1"; usage ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
4
scripts/run.sh
Executable file
4
scripts/run.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
uvicorn main:app --host $API_HOST --port $API_PORT
|
||||||
@@ -55,6 +55,6 @@ export PATH="$HOME/.local/bin:$PATH"
|
|||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
|
|
||||||
sudo usermod -aG docker $USER
|
sudo usermod -aG docker $USER
|
||||||
|
newgrp docker
|
||||||
# Run the manager.sh script with the "install" argument
|
# Run the manager.sh script with the "install" argument
|
||||||
"$APP_DIR/scripts/manager.sh" install
|
"$APP_DIR/scripts/manager.sh" install
|
||||||
Reference in New Issue
Block a user