ci(Dev): Using docker to serve django and vue on same host.
This commit is contained in:
		
							
								
								
									
										8
									
								
								django.Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								django.Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | from python:3.12-slim | ||||||
|  |  | ||||||
|  | WORKDIR /app/ | ||||||
|  |  | ||||||
|  | COPY requirements.txt ./ | ||||||
|  | RUN pip install --no-cache-dir -r requirements.txt | ||||||
|  |  | ||||||
|  | CMD ["python", "manage.py", "runserver", "0.0.0.0:9090"] | ||||||
							
								
								
									
										19
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | |||||||
|  | services: | ||||||
|  |   nginx: | ||||||
|  |     build: | ||||||
|  |       context: ./ | ||||||
|  |       dockerfile: nginx.Dockerfile | ||||||
|  |     ports: | ||||||
|  |       - "7000:80" | ||||||
|  |     volumes: | ||||||
|  |       - ./nginx.conf:/etc/nginx/conf.d/default.conf | ||||||
|  |       - ./tienda_ilusion/don_confiao/static/frontend:/var/www/frontend/ | ||||||
|  |   django: | ||||||
|  |     build: | ||||||
|  |       context: ./ | ||||||
|  |       dockerfile: django.Dockerfile | ||||||
|  |     volumes: | ||||||
|  |       - ./tienda_ilusion:/app/ | ||||||
|  |     ports: | ||||||
|  |       - 7001:9090 | ||||||
|  |    | ||||||
							
								
								
									
										10
									
								
								nginx.Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								nginx.Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | FROM nginx:latest | ||||||
|  |  | ||||||
|  | # Copiamos el archivo de configuración NGINX | ||||||
|  | COPY nginx.conf /etc/nginx/conf.d/default.conf | ||||||
|  |  | ||||||
|  | # Establecemos la variable de entorno para el proxy inverso | ||||||
|  | ENV DJANGO_PROXY_URL http://django:8000 | ||||||
|  |  | ||||||
|  | # Creamos un directorio estático | ||||||
|  | RUN mkdir -p /var/www/frontend | ||||||
							
								
								
									
										18
									
								
								nginx.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								nginx.conf
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | |||||||
|  | server { | ||||||
|  |     listen 80; | ||||||
|  |     server_name donconfiao.org; | ||||||
|  |  | ||||||
|  |     location /frontend { | ||||||
|  |         alias /var/www/frontend/; | ||||||
|  |         # index index.html; | ||||||
|  |         autoindex on; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     location / { | ||||||
|  |         proxy_pass http://django:9090; | ||||||
|  |         proxy_set_header Host $host; | ||||||
|  |         proxy_set_header X-Real-IP $remote_addr; | ||||||
|  |         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||||||
|  |         proxy_set_header X-Forwarded-Proto $scheme; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -67,5 +67,5 @@ export default defineConfig({ | |||||||
|   build: { |   build: { | ||||||
|     outDir: '../../static/frontend/',  |     outDir: '../../static/frontend/',  | ||||||
|   }, |   }, | ||||||
|   base: '/static/frontend/', |   base: '/frontend/', | ||||||
| }) | }) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user