🐳 updated dockerfile
This commit is contained in:
		
							parent
							
								
									bf9334ed1f
								
							
						
					
					
						commit
						006fe93d08
					
				
					 2 changed files with 9 additions and 6 deletions
				
			
		|  | @ -1,7 +1,7 @@ | |||
| # syntax=docker/dockerfile:1 | ||||
| 
 | ||||
| # Start from the latest golang base image | ||||
| FROM golang:latest | ||||
| FROM golang:latest AS build | ||||
| 
 | ||||
| # Set the Current Working Directory inside the container | ||||
| WORKDIR /app | ||||
|  | @ -13,10 +13,13 @@ COPY . . | |||
| RUN go mod download | ||||
| 
 | ||||
| # Build the Go app - change directory to 'cmd' where main.go resides | ||||
| RUN go build -o main ./cmd | ||||
| RUN go build -o /app/hello | ||||
| 
 | ||||
| # Expose port 8080 to the outside world | ||||
| EXPOSE 8080 | ||||
| FROM alpine:latest | ||||
| 
 | ||||
| WORKDIR /app | ||||
| 
 | ||||
| COPY --from=build /app/hello . | ||||
| 
 | ||||
| # Command to run the executable | ||||
| CMD ["./cmd/main"] | ||||
| CMD ["./hello"] | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ services: | |||
|       context: . | ||||
|       dockerfile: Dockerfile | ||||
|     ports: | ||||
|       - 8000:8000 | ||||
|       - 8080:8080 | ||||
|     image: helseveileder | ||||
|     depends_on: | ||||
|       - postgres | ||||
|  |  | |||
		Reference in a new issue
	
	 haraldnilsen
						haraldnilsen