fix: Dockerfile now builds a usable image
/ build-deploy (push) Successful in 2m3s Details

This commit is contained in:
Florian Beisel 2024-01-10 01:11:25 +01:00
parent 55f794e8ef
commit 3afbe2044e
Signed by: florian
GPG Key ID: 79ECA2E54996FF4D
1 changed files with 6 additions and 5 deletions

View File

@ -1,22 +1,23 @@
# Start from a Go base image
FROM golang:latest as builder
FROM golang:alpine3.19 AS builder
# Set the working directory
WORKDIR /app
# Copy the source code into the container
COPY . .
RUN go mod download
# Build the application
RUN go build -o mybot .
RUN CGO_ENABLED=0 GOOS=linux go build -o mybot .
# Use a small base image
FROM alpine:latest
FROM alpine:edge
WORKDIR /root/
WORKDIR /app/
# Copy the binary from the builder stage
COPY --from=builder /app/mybot .
COPY --from=builder /app/mybot /app/
# Command to run the executable
CMD ["./mybot"]