handle browser back button with nav link
This commit is contained in:
39
Dockerfile
Normal file
39
Dockerfile
Normal file
@@ -0,0 +1,39 @@
|
||||
# ------------------------------------------------------
|
||||
# 1. Build Stage
|
||||
# ------------------------------------------------------
|
||||
FROM golang:1.25-alpine AS builder
|
||||
|
||||
# Install necessary build tools for SQLite (CGO)
|
||||
RUN apk add --no-cache gcc musl-dev sqlite-dev
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Cache dependencies
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy source files
|
||||
COPY . .
|
||||
|
||||
# Build with CGO enabled for SQLite
|
||||
RUN CGO_ENABLED=1 GOOS=linux go build -o server main.go
|
||||
|
||||
# ------------------------------------------------------
|
||||
# 2. Runtime Stage
|
||||
# ------------------------------------------------------
|
||||
FROM alpine:3.20
|
||||
|
||||
# Install SQLite (if your app interacts directly with .db file)
|
||||
RUN apk add --no-cache sqlite
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy binary and required files
|
||||
COPY --from=builder /app/server .
|
||||
COPY --from=builder /app/css ./css
|
||||
COPY --from=builder /app/views ./views
|
||||
COPY --from=builder /app/my_website.db ./
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["./server"]
|
||||
Reference in New Issue
Block a user