ess-etl-go/Dockerfile

29 lines
794 B
Docker
Raw Permalink Normal View History

2023-04-03 19:29:11 +02:00
FROM golang:1.19-buster as builder
# Create and change to the app directory.
WORKDIR /app
# Retrieve application dependencies.
# This allows the container build to reuse cached dependencies.
# Expecting to copy go.mod and if present go.sum.
COPY go.* ./
RUN go mod download
# Copy local code to the container image.
COPY . ./
# Build the binary.
RUN go build -v -o etl ./cmd/etl/main.go
# Use the official Debian slim image for a lean production container.
FROM debian:buster-slim
RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Copy the binary to the production image from the builder stage.
COPY --from=builder /app/etl /app/etl
# Run the web service on container startup.
CMD ["/app/etl"]