Deploy to production: GitHub Actions + ghcr.io + Kubernetes

- Switch from Gitea to GitHub Container Registry (ghcr.io)
- Add GitHub Actions workflow with Tailscale connectivity
- Update k8s manifests for cloud nodes and Traefik ingress
- Configure for turbo.kazcloud.dev domain
- Test deployment with home page text change
This commit is contained in:
2026-03-29 08:46:27 -04:00
parent 2bb1dfa1e4
commit 69993a3bf5
14 changed files with 793 additions and 596 deletions

View File

@@ -1,42 +1,62 @@
# TurboVault Production Dockerfile
# Multi-stage build for optimized image size
# Stage 1: Build environment
FROM ruby:3.3-slim as builder
# Stage 1: Builder - Full environment with all gems
FROM ruby:3.3-slim AS builder
# Install build dependencies
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
libyaml-dev \
nodejs \
npm \
git \
curl && \
rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Install gems
# Install ALL gems first (needed for asset compilation)
COPY Gemfile Gemfile.lock ./
RUN bundle config set --local deployment 'true' && \
bundle config set --local without 'development test' && \
bundle install --jobs 4 --retry 3
RUN bundle install --jobs 4 --retry 3
# Copy application code
COPY . .
# Precompile assets
ENV RAILS_ENV=production \
NODE_ENV=production \
SECRET_KEY_BASE=dummy
RUN bundle exec rails assets:precompile
# Stage 2: Runtime environment
# Stage 2: Production gems only
FROM ruby:3.3-slim AS gems
# Install build dependencies (needed to install gems with native extensions)
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
libyaml-dev && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install ONLY production gems
COPY Gemfile Gemfile.lock ./
RUN bundle config set --local without 'development test' && \
bundle install --jobs 4 --retry 3
# Stage 3: Runtime - Minimal final image
FROM ruby:3.3-slim
# Install runtime dependencies
# Install ONLY runtime dependencies (no build tools!)
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
libpq5 \
libyaml-0-2 \
curl \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
@@ -44,11 +64,10 @@ RUN apt-get update -qq && \
# Create app user
RUN groupadd -r app && useradd -r -g app app
# Set working directory
WORKDIR /app
# Copy gems from builder
COPY --from=builder /usr/local/bundle /usr/local/bundle
# Copy production gems from gems stage
COPY --from=gems /usr/local/bundle /usr/local/bundle
# Copy application code
COPY --chown=app:app . .