feat: Add Docker containerization with Gitea Actions

This commit is contained in:
Pat Teruel
2025-12-30 21:18:32 +08:00
parent 56ab8c02b5
commit d6d3fe4d7f
5 changed files with 352 additions and 0 deletions

34
Dockerfile Normal file
View File

@@ -0,0 +1,34 @@
# Stage 1: Build nginx image with static content
FROM nginx:alpine
# Install dumb-init for proper signal handling
RUN apk add --no-cache dumb-init
# Copy custom nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
# Copy static site content to nginx html directory
COPY karaoke.karaniwan.org/ /usr/share/nginx/html/
# Create nginx user and set permissions
RUN chown -R nginx:nginx /usr/share/nginx/html && \
chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid
# Switch to non-root user
USER nginx
# Expose port 80
EXPOSE 80
# Add healthcheck
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1
# Use dumb-init to handle signals properly
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
# Start nginx
CMD ["nginx", "-g", "daemon off;"]