docker, drone ci
This commit is contained in:
parent
7243500197
commit
9b58fd248b
3 changed files with 95 additions and 0 deletions
39
Dockerfile
Normal file
39
Dockerfile
Normal file
|
@ -0,0 +1,39 @@
|
|||
# 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
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
|
||||
|
||||
# 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
|
||||
COPY --from=builder /app/main .
|
||||
|
||||
# Expose port 8080
|
||||
EXPOSE 8080
|
||||
|
||||
# Run Executable
|
||||
CMD ["./main"]
|
Reference in a new issue