Webchance/Dockerfile
u80864958 76a3047f7f
Some checks failed
Release / publish (push) Failing after 20s
dockerize & autobuild
2024-09-26 17:03:10 +02:00

31 lines
726 B
Docker

# Use an official Go runtime as a parent image
FROM golang:1.22.7-alpine as builder
# Set the working directory inside the container
WORKDIR /app
# Copy the Go application code into the container
COPY . .
# Build the Go app, outputting an executable named "app"
RUN go build -o app .
# Use a minimal base image to run the app, keeping the image small
FROM alpine:latest
# Set the working directory inside the container
WORKDIR /root/
# Copy the binary from the builder image
COPY --from=builder /app/app .
# Copy any necessary static files (if any are in your static folder)
COPY --from=builder /app/static ./static
# Expose the port the app runs on
EXPOSE 8080
# Run the app when the container starts
CMD ["./app"]