This repository has been archived on 2024-05-18. You can view files and clone it, but cannot push or open issues or pull requests.
2021-09-20 18:54:25 +02:00
|
|
|
# GO Repo base repo
|
|
|
|
FROM golang:alpine3.14 as builder
|
|
|
|
|
|
|
|
RUN apk add git
|
|
|
|
|
|
|
|
# Add Maintainer Info
|
|
|
|
LABEL maintainer="<Philipp Böhm>"
|
|
|
|
|
|
|
|
RUN mkdir /app
|
|
|
|
ADD . /app
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
|
|
|
|
# Download all the dependencies
|
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Build the Go app
|
2021-09-20 22:55:12 +02:00
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main ./cmd/main.go
|
2021-09-20 18:54:25 +02:00
|
|
|
|
|
|
|
# GO Repo base repo
|
|
|
|
FROM alpine:latest
|
|
|
|
|
|
|
|
RUN apk --no-cache add ca-certificates curl
|
|
|
|
|
|
|
|
RUN mkdir /app
|
|
|
|
|
|
|
|
WORKDIR /app/
|
|
|
|
|
|
|
|
# Copy the Pre-built binary file from the previous stage
|
2021-09-20 22:55:12 +02:00
|
|
|
COPY --from=builder /app .
|
2021-09-20 18:54:25 +02:00
|
|
|
|
2021-09-20 22:55:12 +02:00
|
|
|
# Expose port 3000
|
|
|
|
EXPOSE 3000
|
2021-09-20 18:54:25 +02:00
|
|
|
|
|
|
|
# Run Executable
|
|
|
|
CMD ["./main"]
|