eg3 finished Backend only
parent
155195ddda
commit
72a0a57842
|
@ -2,3 +2,10 @@
|
|||
|
||||
[How To Run Multiple Docker Containers Under One URL](https://codingwithmanny.medium.com/create-an-nginx-reverse-proxy-with-docker-a1c0aa9078f1)
|
||||
|
||||
## Backend only
|
||||
|
||||
How to test it:
|
||||
|
||||
1. Comment all other containers
|
||||
2. Run `docker compose build` & `docker compose up`
|
||||
3. Test by `curl localhost:5000`, should return `{"version":"1.0.0"}`
|
|
@ -1,8 +0,0 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
backend:
|
||||
container_name: backend
|
||||
build: .
|
||||
ports:
|
||||
- "5000:5000"
|
|
@ -0,0 +1,27 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
# proxy:
|
||||
# container_name: proxy
|
||||
# build:
|
||||
# context: ./proxy
|
||||
# dockerfile: Dockerfile
|
||||
# ports:
|
||||
# - "80:80"
|
||||
# depends_on:
|
||||
# - frontend
|
||||
# - backend
|
||||
|
||||
# frontend:
|
||||
# container_name: frontend
|
||||
# build:
|
||||
# context: ./frontend
|
||||
# dockerfile: Dockerfile
|
||||
|
||||
backend:
|
||||
container_name: backend
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "5000:5000" # Uncomment this line if you want to run the backend container only
|
|
@ -1,8 +0,0 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
frontend:
|
||||
container_name: frontend
|
||||
build: .
|
||||
# ports:
|
||||
# - "80:80"
|
|
@ -1,4 +1,9 @@
|
|||
FROM nginx:stable-alpine
|
||||
WORKDIR /etc/nginx/conf.d
|
||||
COPY default.conf .
|
||||
CMD [ "nginx", "-s", "reload"]
|
||||
COPY default.conf /etc/nginx/conf.d
|
||||
|
||||
EXPOSE 80/tcp
|
||||
EXPOSE 443/tcp
|
||||
|
||||
CMD [ "/bin/sh", "-c", "exec nginx -g 'daemon off;';"]
|
||||
|
||||
WORKDIR /usr/share/nginx/html
|
|
@ -1,6 +1,5 @@
|
|||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
proxy:
|
||||
container_name: proxy
|
||||
build: .
|
||||
ports:
|
||||
- "80:80"
|
Loading…
Reference in New Issue