Add ARG TARGETOS TARGETARCH to fix multi-platform builds.
This commit is contained in:
		
							parent
							
								
									022ed0e03e
								
							
						
					
					
						commit
						2e2205d938
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
					@ -11,6 +11,9 @@ RUN go mod download
 | 
				
			||||||
COPY . .
 | 
					COPY . .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build the application for the specified target architecture
 | 
					# Build the application for the specified target architecture
 | 
				
			||||||
 | 
					# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
 | 
				
			||||||
 | 
					# Declare TARGETOS and TARGETARCH in the local scope so they can be used in the build stage.
 | 
				
			||||||
 | 
					ARG TARGETOS TARGETARCH
 | 
				
			||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o p1-logger .
 | 
					RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o p1-logger .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Create a minimal runtime image
 | 
					# Create a minimal runtime image
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue