2 Commits

Author SHA1 Message Date
3398dc786b don't install apt-get recommendations
All checks were successful
Gitea Actions Demo / lint (push) Successful in 21s
Gitea Actions Demo / test (push) Successful in 14s
Gitea Actions Demo / docker (push) Successful in 2m29s
2025-04-29 13:52:08 -05:00
9f873ffaea set PORT and PIDFILE via environment variables
Some checks failed
Gitea Actions Demo / lint (push) Successful in 22s
Gitea Actions Demo / test (push) Successful in 14s
Gitea Actions Demo / docker (push) Has been cancelled
2025-04-28 15:31:09 -05:00
6 changed files with 33 additions and 58 deletions

2
app.rb
View File

@ -21,7 +21,7 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + "/lib"
require "config"
VERSION = "0.2.0"
VERSION = "0.1.4"
CHUNK_SIZE = 1024**2
SESSION_SECRET_HEX_LENGTH = 64

View File

@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.0
version: 0.1.4
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.2.0"
appVersion: "0.1.4"

View File

@ -1,51 +1,43 @@
ARG RUBY_VERSION="3.4.3"
FROM docker.io/library/ruby:${RUBY_VERSION}-alpine AS base
FROM ruby:${RUBY_VERSION}-alpine AS base
WORKDIR /kubernaut
WORKDIR /app
RUN <<EOT
apk update -q
apk add bash
rm -rf /var/cache/apk
apk update
gem update --system --no-document
gem install -N bundler
EOT
ENV RACK_ENV="production" \
BUNDLE_DEPLOYMENT=true \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development test"
FROM base AS build
ENV BUNDLE_DEPLOYMENT=true \
BUNDLE_WITHOUT="development test"
RUN <<EOT
apk add musl-dev gcc make
rm -rf /var/cache/apk
EOT
COPY Gemfile Gemfile.lock ./
COPY Gemfile* .
RUN <<EOT
bundle install
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
EOT
COPY . .
FROM base
ENV PORT=4567
RUN <<EOT
addgroup --system --gid 666 kubernaut
adduser --system --uid 666 --ingroup kubernaut --shell /bin/bash --disabled-password kubernaut
EOT
RUN adduser --home /app --disabled-password app
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /kubernaut /kubernaut
USER app:app
USER kubernaut:kubernaut
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build --chown=app:app /app /app
COPY --chown=app:app . .
EXPOSE $PORT
ENTRYPOINT [ "/kubernaut/dockerfiles/entrypoint.sh" ]
CMD [ "bundle", "exec", "puma" ]
CMD [ "puma" ]

View File

@ -1,51 +1,44 @@
ARG RUBY_VERSION="3.4.3"
FROM docker.io/library/ruby:${RUBY_VERSION}-slim-bookworm AS base
FROM ruby:${RUBY_VERSION}-slim-bookworm AS base
WORKDIR /kubernaut
WORKDIR /app
RUN <<EOT
apt-get update -qq
rm -rf /var/lib/apt/lists /var/cache/apt/archives
apt-get update
gem update --system --no-document
gem install -N bundler
EOT
ENV RACK_ENV="production" \
BUNDLE_DEPLOYMENT=true \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development test"
FROM base AS build
ENV BUNDLE_DEPLOYMENT=true \
BUNDLE_WITHOUT="development test"
RUN <<EOT
apt-get update -qq
apt-get install --yes --no-install-recommends gcc make libc-dev
rm -rf /var/lib/apt/lists /var/cache/apt/archives
EOT
COPY Gemfile Gemfile.lock ./
COPY Gemfile* .
RUN <<EOT
bundle install
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
EOT
COPY . .
FROM base
ENV PORT=4567
RUN <<EOT
groupadd --system --gid 666 kubernaut
useradd --system --uid 666 --gid kubernaut --create-home --shell /bin/bash kubernaut
EOT
# RUN useradd ruby --home /app --shell /bin/sh
RUN useradd --home /app --create-home app
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /kubernaut /kubernaut
USER app:app
USER kubernaut:kubernaut
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build --chown=app:app /app /app
COPY --chown=app:app . .
EXPOSE $PORT
ENTRYPOINT [ "/kubernaut/dockerfiles/entrypoint.sh" ]
CMD [ "bundle", "exec", "puma" ]
CMD [ "puma" ]

View File

@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
# output debugging info
ruby --version
printf "rubygems %s\n" "$(gem --version)"
bundle version
exec "${@}"

View File

@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: kubernaut
image: git.kill0.net/ryanc/kubernaut:0.2.0
image: git.kill0.net/ryanc/kubernaut:0.1.4
imagePullPolicy: Always
ports:
- name: sinatra-web