Some checks failed
CI/CD Pipeline / Build Docker Image (push) Has been cancelled
CI/CD Pipeline / Test (push) Has been cancelled
CI/CD Pipeline / Build (arm64, windows, linkbeam-windows-arm64.exe) (push) Has been cancelled
CI/CD Pipeline / Build (386, linux, linkbeam-linux-386) (push) Has been cancelled
CI/CD Pipeline / Lint (push) Has been cancelled
CI/CD Pipeline / Build (amd64, linux, linkbeam-linux-amd64) (push) Has been cancelled
CI/CD Pipeline / Build (arm, 7, linux, linkbeam-linux-armv7) (push) Has been cancelled
CI/CD Pipeline / Build (386, windows, linkbeam-windows-386.exe) (push) Has been cancelled
CI/CD Pipeline / Build (amd64, windows, linkbeam-windows-amd64.exe) (push) Has been cancelled
CI/CD Pipeline / Build (arm64, darwin, linkbeam-darwin-arm64) (push) Has been cancelled
CI/CD Pipeline / Build (arm64, linux, linkbeam-linux-arm64) (push) Has been cancelled
CI/CD Pipeline / Build (amd64, darwin, linkbeam-darwin-amd64) (push) Has been cancelled
CI/CD Pipeline / Create Release (push) Has been cancelled
56 lines
1.1 KiB
Docker
56 lines
1.1 KiB
Docker
# Build stage
|
|
FROM golang:1.21-alpine AS builder
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache git make
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy go mod files
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN CGO_ENABLED=0 GOOS=linux go build \
|
|
-a -installsuffix cgo \
|
|
-ldflags="-s -w -X main.Version=${VERSION:-dev} -X main.Commit=${COMMIT:-unknown}" \
|
|
-o linkbeam \
|
|
./cmd/linkbeam
|
|
|
|
# Final stage
|
|
FROM alpine:latest
|
|
|
|
# Install ca-certificates for HTTPS
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy binary from builder
|
|
COPY --from=builder /app/linkbeam /app/linkbeam
|
|
|
|
# Copy templates and themes
|
|
COPY templates /app/templates
|
|
COPY themes /app/themes
|
|
|
|
# Create config directory
|
|
RUN mkdir -p /app/config
|
|
|
|
# Expose port (if needed for future HTTP server)
|
|
EXPOSE 8080
|
|
|
|
# Set default config path
|
|
ENV CONFIG_PATH=/app/config/config.yaml
|
|
|
|
# Run as non-root user
|
|
RUN addgroup -g 1000 linkbeam && \
|
|
adduser -D -u 1000 -G linkbeam linkbeam && \
|
|
chown -R linkbeam:linkbeam /app
|
|
|
|
USER linkbeam
|
|
|
|
ENTRYPOINT ["/app/linkbeam"]
|
|
CMD ["--config", "/app/config/config.yaml", "--output", "/app/dist/index.html"]
|