-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (24 loc) · 792 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Use a generic Linux base image
FROM debian:bullseye AS base
# Install required tools
RUN apt-get update && apt-get install -y curl tar
# Install Go manually (version 1.23.2)
RUN curl -sSL https://go.dev/dl/go1.23.2.linux-amd64.tar.gz | tar -C /usr/local -xzf -
ENV PATH="/usr/local/go/bin:$PATH"
# Set the working directory
WORKDIR /app
# Copy the Go module files and download dependencies
COPY go.mod go.sum ./
RUN go mod tidy
# Copy the application source code
COPY . .
# Build the application
RUN go build -o azure-footprint azure_footprint.go
# Use a minimal image for runtime
FROM debian:bullseye-slim AS runtime
# Set the working directory
WORKDIR /app
# Copy the built application
COPY --from=base /app/azure-footprint /app/
# Run the application
CMD ["./azure-footprint"]