first test

This commit is contained in:
Tomas Dvorak
2026-02-08 14:14:55 +01:00
parent 18aa702174
commit d27cf14110
372 changed files with 98089 additions and 2585 deletions
+45
View File
@@ -0,0 +1,45 @@
# Build stage for YouTube search service
FROM golang:1.21-alpine AS builder
# Install git and other build dependencies
RUN apk add --no-cache git
# Set working directory
WORKDIR /app
# Copy go mod files
COPY search.go ./
# Build the search service
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o youtube-search search.go
# Final stage
FROM alpine:latest
# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates wget
# Create non-root user
RUN addgroup -g 1001 -S appgroup && \
adduser -u 1001 -S appuser -G appgroup
WORKDIR /app
# Copy the binary from builder stage
COPY --from=builder /app/youtube-search .
# Change ownership to non-root user
RUN chown appuser:appgroup youtube-search
# Switch to non-root user
USER appuser
# Expose port
EXPOSE 8090
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8090/youtube?q=test || exit 1
# Run the binary
CMD ["./youtube-search"]