Skip to content

Commit

Permalink
upgrade to docker compose v2
Browse files Browse the repository at this point in the history
  • Loading branch information
tushar5526 committed May 22, 2024
1 parent f58a7fd commit 2453df0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@ FROM python:3.11

WORKDIR /app

RUN apt update -y && apt install docker-compose -y
# Install dependencies and Docker's official GPG key
RUN apt-get update && \
apt-get install -y ca-certificates curl && \
install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc

# Add Docker's official repository to Apt sources
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo $VERSION_CODENAME) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update

RUN apt-get update -y && apt-get install docker-compose-plugin docker-ce-cli -y

COPY requirements.txt ./

Expand Down
4 changes: 2 additions & 2 deletions server/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def start_services(
logger.error(f"Error generating processed compose file: {e}")
raise HTTPException(500, e)

command = ["docker-compose", "up", "-d", "--build"]
command = ["docker", "compose", "up", "-d", "--build"]
project_dir = pathlib.Path(self._compose_file_location).parent

try:
Expand All @@ -109,7 +109,7 @@ def remove_services(self):
if not os.path.exists(pathlib.Path(self._compose_file_location).parent):
logger.info(f"{self._compose_file_location} is already deleted!")
return "Deployment already deleted"
command = ["docker-compose", "down", "-v"]
command = ["docker", "compose", "down", "-v"]
project_dir = pathlib.Path(self._compose_file_location).parent
try:
subprocess.run(command, check=True, cwd=project_dir)
Expand Down

0 comments on commit 2453df0

Please sign in to comment.