You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
413 B
Docker
26 lines
413 B
Docker
# ---- Base ----
|
|
FROM alpine:3 AS base
|
|
WORKDIR /app
|
|
|
|
# Install necessary packages
|
|
RUN apk add --no-cache iproute2
|
|
|
|
|
|
# ---- Build ----
|
|
FROM golang:1.19-alpine AS build
|
|
WORKDIR /build
|
|
# Copy sources
|
|
ADD . .
|
|
# Get dependencies
|
|
RUN go get ./cmd/app
|
|
# Compile
|
|
RUN CGO_ENABLED=0 go build -a -o app ./cmd/app
|
|
|
|
|
|
# ---- Release ----
|
|
FROM base AS release
|
|
# Copy build-target
|
|
COPY --from=build /build/app .
|
|
|
|
CMD ["./app"]
|