Add Gin framework and create REST API endpoints
This commit is contained in:
11
Dockerfile
11
Dockerfile
@@ -1,5 +1,5 @@
|
||||
# Build stage
|
||||
FROM golang:1.21-alpine AS builder
|
||||
FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS builder
|
||||
|
||||
# Install git and ca-certificates
|
||||
RUN apk --no-cache add git ca-certificates
|
||||
@@ -15,8 +15,13 @@ RUN go mod download
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o hello-api main.go
|
||||
# Build the application for target platform
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILDPLATFORM
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -installsuffix cgo -o hello-api main.go
|
||||
|
||||
# Final stage
|
||||
FROM alpine:latest
|
||||
|
Reference in New Issue
Block a user