This commit is contained in:
f 2022-02-15 15:23:19 -03:00
parent 8c2c4aa4d8
commit eba74e8eda
3 changed files with 45 additions and 41 deletions

View file

@ -2,23 +2,32 @@ pipeline:
publish: publish:
image: plugins/docker image: plugins/docker
registry: registry.nulo.in registry: registry.nulo.in
repo: registry.nulo.in/sutty/monit repo: registry.nulo.in/sutty/ruby
tags: tags:
- ${ALPINE_VERSION} - ${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}
- latest - latest
build_args: build_args:
- RUBY_VERSION=${RUBY_VERSION}
- ALPINE_VERSION=${ALPINE_VERSION} - ALPINE_VERSION=${ALPINE_VERSION}
- BASE_IMAGE=alpine - BASE_IMAGE=registry.nulo.in/sutty/monit
username: sutty username: sutty
secrets: secrets:
- docker_password - docker_password
cache_from: registry.nulo.in/sutty/monit:${ALPINE_VERSION} cache_from: registry.nulo.in/sutty/ruby:${ALPINE_VERSION}
when: when:
branch: antifascista branch: antifascista
event: push event: push
matrix: matrix:
ALPINE_VERSION: include:
- 3.13.6 - ALPINE_VERSION: 3.13.6
- 3.13.7 RUBY_VERSION: 2.7
- 3.14.3 RUBY_PATCH: 5
- 3.15.0 - ALPINE_VERSION: 3.13.7
RUBY_VERSION: 2.7.5
RUBY_PATCH: 5
- ALPINE_VERSION: 3.14.3
RUBY_VERSION: 2.7.5
RUBY_PATCH: 5
- ALPINE_VERSION: 3.15.0
RUBY_VERSION: 3.0
RUBY_PATCH: 3

View file

@ -1,44 +1,25 @@
ARG ALPINE_VERSION=3.13.6 ARG ALPINE_VERSION=3.13.6
ARG RUBY_VERSION=2.7
ARG RUBY_PATCH=5
ARG BASE_IMAGE=alpine ARG BASE_IMAGE=alpine
ARG EMAIL=monit@sutty.nl ARG EMAIL=monit@sutty.nl
FROM ${BASE_IMAGE}:${ALPINE_VERSION} as build FROM ${BASE_IMAGE}:${ALPINE_VERSION} as build
ENV EMAIL ${EMAIL:-monit@sutty.nl} ENV EMAIL ${EMAIL:-monit@sutty.nl}
RUN apk add --no-cache tzdata RUN apk add --no-cache ruby patch
RUN test "${RUBY_VERSION}.${RUBY_PATCH}" = `ruby -e 'puts RUBY_VERSION'`
COPY ./monitrc /etc/monitrc # Patch rubygems to install x86_64-linux-musl gems
RUN chmod 600 /etc/monitrc COPY ./rubygems-platform-musl.patch /tmp/
RUN sed -re "s/@@EMAIL@@/${EMAIL}/" -i /etc/monitrc RUN cd /usr/lib/ruby/${RUBY_VERSION}.0 && patch -Np 0 -i /tmp/rubygems-platform-musl.patch || true
FROM ${BASE_IMAGE}:${ALPINE_VERSION} FROM ${BASE_IMAGE}:${ALPINE_VERSION}
ARG ALPINE_VERSION ARG ALPINE_VERSION
ARG RUBY_VERSION
ARG RUBY_PATCH
MAINTAINER "f <f@sutty.nl>" MAINTAINER "f <f@sutty.nl>"
# Locale # Install ruby and extracted gems and copy patched rubygems
ENV LANG="C.UTF-8" RUN apk add --no-cache tzdata ruby && rm /usr/lib/ruby/${RUBY_VERSION}.0/rubygems.rb
RUN apk add --no-cache ruby-json ruby-bigdecimal ruby-rake ruby-bundler ruby-irb ruby-io-console ruby-etc
# Sutty's repository COPY --from=build /usr/lib/ruby/${RUBY_VERSION}.0/rubygems.rb /usr/lib/ruby/${RUBY_VERSION}.0/
RUN echo ${ALPINE_VERSION} | cut -d . -f 1,2 | xargs -I {} echo https://alpine.sutty.nl/alpine/v{}/sutty | tee -a /etc/apk/repositories
RUN wget https://alpine.sutty.nl/alpine/sutty.pub -O /etc/apk/keys/alpine@sutty.nl-5ea884cd.rsa.pub
# Install monit and remove default config
RUN apk add --no-cache tini monit knsupdate
COPY --from=build /usr/share/zoneinfo/UTC /etc/localtime
# Create directories
RUN install -dm 2750 -o root -g root /etc/monit.d
RUN install -dm 2750 -o root -g root /var/lib/monit
# Install config
COPY --from=build /etc/monitrc /etc/monitrc
COPY ./nsupdate.sh /usr/local/bin/nsupdate
COPY ./whatsmyip6.sh /usr/local/bin/whatsmyip6
# Allow access to the web GUI
EXPOSE 2812
# Use tini as init
ENTRYPOINT ["/sbin/tini", "--"]
# Run monit, it will take care of running services afterwards
CMD ["/usr/bin/monit"]

View file

@ -0,0 +1,14 @@
--- rubygems.rb.orig
+++ rubygems.rb
@@ -764,10 +764,7 @@
def self.platforms
@platforms ||= []
if @platforms.empty?
- # XXX: Patched to avoid installing platform-specific gems with binaries
- # linked against glibc.
- @platforms = [Gem::Platform::RUBY]
- #@platforms = [Gem::Platform::RUBY, Gem::Platform.local]
+ @platforms = [Gem::Platform::RUBY, Gem::Platform.local]
end
@platforms
end