1
0
mirror of https://github.com/axzilla/templui.git synced 2025-02-06 10:44:17 +00:00
templui/Dockerfile

38 lines
715 B
Docker

# Build-Stage
FROM golang:1.23-alpine AS build
WORKDIR /app
# Copy the source code
COPY . .
# Install templ
RUN go install github.com/a-h/templ/cmd/templ@latest
# Generate templ files
RUN templ generate
# Install build dependencies
RUN apk add --no-cache gcc musl-dev
# Build the application
RUN CGO_ENABLED=1 GOOS=linux go build -o main ./cmd/server/main.go
# Deploy-Stage
FROM alpine:3.20.2
WORKDIR /app
# Install ca-certificates
RUN apk add --no-cache ca-certificates
# Set environment variable for runtime
ENV GO_ENV=production
# Copy the binary from the build stage
COPY --from=build /app/main .
# Expose the port your application runs on
EXPOSE 8090
# Command to run the application
CMD ["./main"]