Files
hse-2026/materials/02-communication/grpc-practice/go-server/Dockerfile
T

34 lines
752 B
Docker
Raw Normal View History

2026-09-14 14:45:31 +03:00
# Dockerfile was generated from
# https://github.com/lodthe/dockerfiles/blob/main/go/Dockerfile
FROM golang:1.21-alpine3.19 AS builder
# Setup base software for building an app.
RUN apk update && apk add ca-certificates git gcc g++ libc-dev binutils
WORKDIR /opt
# Download dependencies.
COPY go.mod go.sum ./
RUN go mod download && go mod verify
# Copy application source.
COPY . .
# Build the application.
RUN go build -o bin/application .
# Prepare executor image.
FROM alpine:3.19 AS runner
RUN apk update && apk add ca-certificates libc6-compat openssh bash && rm -rf /var/cache/apk/*
WORKDIR /opt
COPY --from=builder /opt/bin/application ./
# Add required static files.
#COPY assets assets
# Run the application.
CMD ["./application"]