From 469415b057ca9f50764b0962d496961c666b7d3f Mon Sep 17 00:00:00 2001 From: Soaibuzzaman Date: Tue, 25 Jun 2024 11:02:31 +0200 Subject: [PATCH] Updated docker files --- .env.example | 5 +---- README.md | 50 ++++++++------------------------------------- backend/Dockerfile | 7 ++----- docker-compose.yml | 49 ++++++++------------------------------------ frontend/Dockerfile | 7 ++----- 5 files changed, 21 insertions(+), 97 deletions(-) diff --git a/.env.example b/.env.example index 69acffd..58f4145 100644 --- a/.env.example +++ b/.env.example @@ -11,7 +11,4 @@ FLASK_ENV=development GOOGLE_CLIENT_ID=google-client-id GOOGLE_CLIENT_SECRET=google-client-secret GITHUB_CLIENT_ID=github-client-id -GITHUB_CLIENT_SECRET=github-client-secret -MONGO_URL=mongodb://mongo:27017/meteor -METEOR_SETTINGS={"env": {"API_URL": "http://api:8080","FMP_URL": "http://fmp-backend:8000", "MAX_INSTANCES": 20}} -STARTUP_DELAY=10 +GITHUB_CLIENT_SECRET=github-client-secret \ No newline at end of file diff --git a/README.md b/README.md index ece2393..003c601 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@

FM Playground

FM Playground GitHub Repository size - Total Lines GitHub issues GitHub License
@@ -49,7 +48,10 @@ docker-compose up -d version: '3' services: frontend: - image: ghcr.io/se-buw/fm-playground-frontend:latest + build: + context: ./frontend + args: + VITE_FMP_API_URL: http://localhost:8000/api container_name: fmp-frontend env_file: - .env @@ -60,7 +62,8 @@ services: restart: unless-stopped backend: - image: ghcr.io/se-buw/fm-playground-backend:latest + build: + context: ./backend container_name: fmp-backend env_file: - .env @@ -93,10 +96,9 @@ services: - my_network restart: unless-stopped - # Alloy API - api: + alloy-api: build: - context: ./alloy-app/api/ + context: ./alloy-api container_name: fmp-alloy-api ports: - "8080:8080" @@ -104,45 +106,9 @@ services: - my_network restart: unless-stopped - # Database for alloy - mongo: - image: mongo:4.4.6 - container_name: fmp-mongo - command: mongod --storageEngine=wiredTiger - volumes: - - mongo_data:/data/db - ports: - - "27017:27017" - environment: - MONGO_INITDB_ROOT_USERNAME: root - MONGO_INITDB_ROOT_PASSWORD: example - networks: - - my_network - restart: unless-stopped - - # Alloy application with meteor - meteor: - build: - context: ./alloy-app/meteor/ - container_name: fmp-alloy-app - environment: - MONGO_URL: ${MONGO_URL} - METEOR_SETTINGS: ${METEOR_SETTINGS} - STARTUP_DELAY: ${STARTUP_DELAY} - depends_on: - - backend - - postgres - - mongo - links: - - mongo - - api - networks: - - my_network - restart: unless-stopped volumes: postgres_data: - mongo_data: networks: my_network: diff --git a/backend/Dockerfile b/backend/Dockerfile index 07aa147..1afbb51 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -11,13 +11,10 @@ RUN apt-get install openjdk-17-jdk -y RUN pip install --no-cache-dir --upgrade pip setuptools RUN pip install --no-cache-dir -r requirements.txt -RUN chmod +x ./install_nuxmv.sh -RUN sed -i -e 's/\r$//' install_nuxmv.sh +RUN sed -i -e 's/\r$//' install_nuxmv.sh entrypoint.sh +RUN chmod +x ./install_nuxmv.sh ./entrypoint.sh RUN ./install_nuxmv.sh RUN mkdir logs - EXPOSE 8000 - -RUN chmod a+x ./entrypoint.sh ENTRYPOINT [ "./entrypoint.sh" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index a6aaa2e..170b9c6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,10 @@ version: '3' services: frontend: - image: ghcr.io/se-buw/fm-playground-frontend:latest + build: + context: ./frontend + args: + VITE_FMP_API_URL: http://localhost:8000/api container_name: fmp-frontend env_file: - .env @@ -12,7 +15,8 @@ services: restart: unless-stopped backend: - image: ghcr.io/se-buw/fm-playground-backend:latest + build: + context: ./backend container_name: fmp-backend env_file: - .env @@ -45,10 +49,9 @@ services: - my_network restart: unless-stopped - # Alloy API - api: + alloy-api: build: - context: ./alloy-app/api/ + context: ./alloy-api container_name: fmp-alloy-api ports: - "8080:8080" @@ -56,45 +59,9 @@ services: - my_network restart: unless-stopped - # Database for alloy - mongo: - image: mongo:4.4.6 - container_name: fmp-mongo - command: mongod --storageEngine=wiredTiger - volumes: - - mongo_data:/data/db - ports: - - "27017:27017" - environment: - MONGO_INITDB_ROOT_USERNAME: root - MONGO_INITDB_ROOT_PASSWORD: example - networks: - - my_network - restart: unless-stopped - - # Alloy application with meteor - meteor: - build: - context: ./alloy-app/meteor/ - container_name: fmp-alloy-app - environment: - MONGO_URL: ${MONGO_URL} - METEOR_SETTINGS: ${METEOR_SETTINGS} - STARTUP_DELAY: ${STARTUP_DELAY} - depends_on: - - backend - - postgres - - mongo - links: - - mongo - - api - networks: - - my_network - restart: unless-stopped volumes: postgres_data: - mongo_data: networks: my_network: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 490b140..814974e 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,14 +1,11 @@ FROM node:20-alpine +ARG VITE_FMP_API_URL +ENV VITE_FMP_API_URL=$VITE_FMP_API_URL WORKDIR /app - COPY package.json . RUN npm install - COPY . . - RUN npm run build - EXPOSE 5173 - CMD ["npm", "run", "preview"] \ No newline at end of file