Use ruby image as base for CrisisCleanup

This commit is contained in:
Disassembler 2018-03-16 17:30:11 +01:00
parent 86de624d8c
commit 6bec5b5e55
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
2 changed files with 4 additions and 34 deletions

View File

@ -5,6 +5,7 @@ SOURCE_DIR=$(realpath $(dirname "${0}"))/crisiscleanup
# Check prerequisites
docker image ls | grep -q postfix || $(realpath $(dirname "${0}"))/postfix.sh
docker image ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
docker image ls | grep -q ruby || $(realpath $(dirname "${0}"))/ruby.sh
# Build Docker container
docker build -t crisiscleanup ${SOURCE_DIR}

View File

@ -1,4 +1,4 @@
FROM alpine:3.7
FROM ruby
MAINTAINER Disassembler <disassembler@dasm.cz>
RUN \
@ -9,43 +9,12 @@ RUN \
# Cleanup
&& apk --no-cache del paxctl
RUN \
# Install Ruby runtime dependencies
apk --no-cache add gdbm libressl readline zlib
RUN \
# Install Ruby build dependencies
apk --no-cache add --virtual .deps build-base autoconf gdbm-dev libressl-dev linux-headers readline-dev zlib-dev \
# Download and unpack Ruby
&& wget http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.6.tar.xz -O ruby.tar.xz \
&& mkdir -p /usr/src/ruby \
&& tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1 \
&& rm ruby.tar.xz \
&& cd /usr/src/ruby \
# Hackfix to suppress "Insecure world writable dir" warning
&& sed -ni 'p;13a #define ENABLE_PATH_CHECK 0' file.c \
# Configure compilation + hackfix to detect isnan/isinf macros
&& autoconf \
&& ac_cv_func_isnan=yes ac_cv_func_isinf=yes ./configure --build=x86_64-linux-musl --disable-install-doc --enable-shared \
# Compile and install Ruby
&& make -j $(nproc) \
&& make install \
# Install RubyGems and Bundler
&& mkdir -p /usr/local/etc \
&& echo -e 'install: --no-document\nupdate: --no-document' >/usr/local/etc/gemrc \
&& gem update --system \
# Cleanup
&& cd /tmp \
&& rm -r /usr/src/ruby \
&& apk --no-cache del .deps \
&& rm -rf /root/.gem
ENV RAILS_ENV production
RUN \
# Install runtime dependencies
apk --no-cache add libpq libxml2 libxslt tzdata
ENV RAILS_ENV production
RUN \
# Install build dependencies
apk --no-cache add --virtual .deps build-base git libxml2-dev libxslt-dev linux-headers postgresql-dev yarn zlib-dev \