-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.docs
More file actions
52 lines (39 loc) · 1.37 KB
/
Dockerfile.docs
File metadata and controls
52 lines (39 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Build-Stage
FROM golang:1.24.4 AS build
WORKDIR /app
# Copy the source code
COPY . .
# Install templ
RUN go install github.com/a-h/templ/cmd/templ@v0.3.906
# Generate templ files
RUN templ generate
# Install build dependencies
RUN apt-get update && apt-get install -y curl wget && rm -rf /var/lib/apt/lists/*
# Install Tailwind CSS standalone CLI
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
TAILWIND_URL="https://github.com/tailwindlabs/tailwindcss/releases/download/v4.1.3/tailwindcss-linux-x64"; \
elif [ "$ARCH" = "aarch64" ]; then \
TAILWIND_URL="https://github.com/tailwindlabs/tailwindcss/releases/download/v4.1.3/tailwindcss-linux-arm64"; \
else \
echo "Unsupported architecture: $ARCH"; exit 1; \
fi && \
wget -O tailwindcss "$TAILWIND_URL" && \
chmod +x tailwindcss
# Generate Tailwind CSS output (must happen before go build for embed)
RUN ./tailwindcss -i ./internal/shared/assets/css/input.css -o ./internal/shared/assets/css/output.css --minify
# Build the application as a static binary
RUN CGO_ENABLED=0 GOOS=linux go build -o main ./cmd/docs
# Deploy-Stage
FROM alpine:3.21
WORKDIR /app
# Install ca-certificates
RUN apk add --no-cache ca-certificates
# Set environment variable for runtime
ENV APP_ENV=production
# Copy the binary (CSS is embedded)
COPY --from=build /app/main .
# Expose the port
EXPOSE 8090
# Command to run
CMD ["./main"]