self contained docker and nginx
to self host on my homelab
This commit is contained in:
		
							parent
							
								
									55439d85b5
								
							
						
					
					
						commit
						6bdb3674df
					
				
					 3 changed files with 50 additions and 0 deletions
				
			
		
							
								
								
									
										16
									
								
								Dockerfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Dockerfile
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| # build with nodejs | ||||
| FROM node:16.17.0-bullseye-slim AS build | ||||
| ENV NODE_ENV production | ||||
| WORKDIR /app | ||||
| COPY . /app | ||||
| RUN mkdir -p dist node_modules | ||||
| RUN chown -R node:node . | ||||
| USER node | ||||
| RUN NODE_ENV=development npm ci | ||||
| RUN npm run build | ||||
| 
 | ||||
| # serve compiled files with local nginx config | ||||
| FROM nginx:alpine | ||||
| WORKDIR /app | ||||
| COPY --from=build /app/dist . | ||||
| COPY ./nginx.conf /etc/nginx/nginx.conf | ||||
							
								
								
									
										12
									
								
								docker-compose.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								docker-compose.yml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| version: "3.9" | ||||
| 
 | ||||
| services: | ||||
|   app: | ||||
|     container_name: nginx-fursona | ||||
|     image: nginx-fursona | ||||
|     build: | ||||
|       context: . | ||||
|       dockerfile: Dockerfile | ||||
|     restart: always | ||||
|     ports: | ||||
|       - "9999:8080" | ||||
							
								
								
									
										22
									
								
								nginx.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								nginx.conf
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| events { | ||||
|   worker_connections 1024; | ||||
| } | ||||
| 
 | ||||
| http { | ||||
|   include mime.types; | ||||
|   sendfile on; | ||||
| 
 | ||||
|   server { | ||||
|     listen 8080; | ||||
|     listen [::]:8080; | ||||
| 
 | ||||
|     resolver 127.0.0.11; | ||||
|     autoindex on; | ||||
| 
 | ||||
|     server_name _; | ||||
|     server_tokens off; | ||||
| 
 | ||||
|     root /app; | ||||
|     gzip_static on; | ||||
|   } | ||||
| } | ||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Ava Gaiety W
						Ava Gaiety W