From 31fe9ead633eec7e8a2af4df1f2fc0523f1c9969 Mon Sep 17 00:00:00 2001 From: hsmallbone Date: Mon, 11 Aug 2025 21:24:19 +0800 Subject: [PATCH 1/2] Use docker registry specifiers and remove unnecessary network --- client/Dockerfile | 4 ++-- docker-compose.yml | 29 +++++++---------------------- server/Dockerfile | 2 +- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/client/Dockerfile b/client/Dockerfile index 6f8274e..a5a123d 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,5 +1,5 @@ # Build stage -FROM node:20-slim as build +FROM docker://node:20-slim as build WORKDIR /app # Copy package files COPY package*.json ./ @@ -11,7 +11,7 @@ COPY . . RUN npm run build # Production stage -FROM nginx:alpine +FROM docker://nginx:alpine # Copy the built assets from build stage COPY --from=build /app/dist /usr/share/nginx/html # Expose port 80 diff --git a/docker-compose.yml b/docker-compose.yml index f2687b6..a1d11e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,10 +6,6 @@ services: dockerfile: Dockerfile depends_on: - mongodb - ports: - - "8000:8000" - networks: - - app-network environment: - MONGODB__DATABASE_NAME=quickgraph - MONGODB__URI=mongodb://root:example@mongodb:27017 @@ -17,31 +13,27 @@ services: client: image: quickgraph-client + ports: + - "3000:80" build: context: ./client dockerfile: Dockerfile - ports: - - "8080:80" depends_on: - server - docs - networks: - - app-network environment: - - VITE_API_BASE_URL=http://localhost:8000/api - - VITE_DOC_BASE_URL=http://localhost:4000 + - VITE_API_BASE_URL=http://server:8000/api + - VITE_DOC_BASE_URL=http://docs:4000 mongodb: - image: mongo:latest + image: docker.io/mongo:latest ports: - "27018:27017" volumes: - - mongodb_data:/data/db + - mongodb_data:/data/db:z environment: - MONGO_INITDB_ROOT_USERNAME=root - MONGO_INITDB_ROOT_PASSWORD=example - networks: - - app-network docs: build: @@ -51,13 +43,11 @@ services: - "4000:4000" volumes: - static_img:/app/static/img - networks: - - app-network depends_on: - init-static-img init-static-img: - image: curlimages/curl:latest + image: docker.io/curlimages/curl:latest user: root volumes: - static_img:/app/static/img @@ -91,11 +81,6 @@ services: chmod -R 755 /app/static/img && echo "Initialization complete" ' - volumes: mongodb_data: static_img: - -networks: - app-network: - driver: bridge diff --git a/server/Dockerfile b/server/Dockerfile index 89484e0..37731d6 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-slim +FROM docker://python:3.10-slim WORKDIR /app From a9a80d86a272665408b19fcc039556ad8e030ef0 Mon Sep 17 00:00:00 2001 From: hsmallbone Date: Tue, 12 Aug 2025 17:35:38 +0800 Subject: [PATCH 2/2] Revert VITE URL changes as they are used clientside --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a1d11e6..31798a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: build: context: ./server dockerfile: Dockerfile + ports: + - "8000:8000" depends_on: - mongodb environment: @@ -22,13 +24,11 @@ services: - server - docs environment: - - VITE_API_BASE_URL=http://server:8000/api - - VITE_DOC_BASE_URL=http://docs:4000 + - VITE_API_BASE_URL=http://localhost:8000/api + - VITE_DOC_BASE_URL=http://localhost:4000 mongodb: image: docker.io/mongo:latest - ports: - - "27018:27017" volumes: - mongodb_data:/data/db:z environment: