Updated the scripts and Dockerfile
This commit is contained in:
18
Dockerfile
18
Dockerfile
@@ -16,19 +16,19 @@ WORKDIR /app
|
|||||||
# && rm -rf /var/lib/apt/lists/*
|
# && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|
||||||
# Clone the Git repository
|
RUN mkdir files/
|
||||||
RUN apt-get update
|
COPY files/requirements.txt files/requirements.txt
|
||||||
RUN apt-get install -y git \
|
RUN sleep 5
|
||||||
&& git clone https://gitea.abdulhade.com/abdulhade/db-middleware.git . \
|
|
||||||
&& apt-get remove -y git \
|
|
||||||
&& apt-get autoremove -y \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Install Python dependencies
|
# Install Python dependencies
|
||||||
RUN pip install --no-cache-dir -r files/requirements.txt
|
RUN pip install --no-cache-dir -r files/requirements.txt
|
||||||
|
|
||||||
# Expose port 8080 for the FastAPI application
|
# Expose port 8080 for the FastAPI application
|
||||||
EXPOSE 8080
|
# EXPOSE 8080
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN rm files/db.sqlite
|
||||||
|
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"]
|
||||||
10
README.md
10
README.md
@@ -1,2 +1,10 @@
|
|||||||
# db-middleware
|
# Capital Index Database Middleware
|
||||||
|
|
||||||
|
### This repo contains:
|
||||||
|
|
||||||
|
1. Middleware Source Code
|
||||||
|
2. Dockerfile
|
||||||
|
3. Install & Manage Script
|
||||||
|
|
||||||
|
### Getting Started:
|
||||||
|
Run this command:
|
||||||
|
|||||||
@@ -1 +1,77 @@
|
|||||||
docker build -t db-middleware .
|
#!/bin/bash
|
||||||
|
|
||||||
|
APP_DIR="$HOME/.db-middleware"
|
||||||
|
CODE_DIR="$HOME/.db-middleware/code"
|
||||||
|
|
||||||
|
install() {
|
||||||
|
echo "Installing the Middleware."
|
||||||
|
cd "$CODE_DIR"
|
||||||
|
|
||||||
|
docker build -t db-middleware .
|
||||||
|
|
||||||
|
echo "Installed the Middleware Successfully."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function for the "upgrade" command
|
||||||
|
upgrade() {
|
||||||
|
echo "Running the 'upgrade' function."
|
||||||
|
# Add your upgrade logic here
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function for the "status" command
|
||||||
|
status() {
|
||||||
|
echo "Running the 'status' function."
|
||||||
|
# Add your status-checking logic here
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function for the "start" command
|
||||||
|
start() {
|
||||||
|
echo "Running the 'start' function."
|
||||||
|
# Add your start logic here
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function for the "stop" command
|
||||||
|
stop() {
|
||||||
|
echo "Running the 'stop' function."
|
||||||
|
# Add your stop logic here
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to display usage instructions
|
||||||
|
usage() {
|
||||||
|
echo "Usage: $0 {install|upgrade|status|start|stop}"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main script logic
|
||||||
|
main() {
|
||||||
|
# Check if an argument is provided
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Handle the argument
|
||||||
|
case "$1" in
|
||||||
|
install)
|
||||||
|
install
|
||||||
|
;;
|
||||||
|
upgrade)
|
||||||
|
upgrade
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status
|
||||||
|
;;
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid argument: $1"
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run the script with the provided arguments
|
||||||
|
main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user