mirror of
https://github.com/andwati/url-shortener.git
synced 2026-11-25 11:38:46 +00:00
added htmx, picocss postgres
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
# Dockerfile
|
||||
FROM golang:1.24-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy go.mod and go.sum files
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
# Download dependencies
|
||||
RUN go mod download
|
||||
|
||||
# Copy the source code
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o url-shortener .
|
||||
|
||||
# Use a smaller image for the final build
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the binary from the builder stage
|
||||
COPY --from=builder /app/url-shortener .
|
||||
|
||||
# Copy templates and static files
|
||||
COPY --from=builder /app/templates ./templates
|
||||
COPY --from=builder /app/static ./static
|
||||
|
||||
# Expose the port
|
||||
EXPOSE 8080
|
||||
|
||||
# Run the binary
|
||||
CMD ["./url-shortener"]
|
||||
Reference in New Issue
Block a user