2022-03-07 15:49:49 +00:00
|
|
|
FROM registry.nulo.in/sutty/rails:3.13.6-2.7.5 AS build
|
2019-07-26 23:57:11 +00:00
|
|
|
MAINTAINER "f <f@sutty.nl>"
|
|
|
|
|
2021-05-19 20:55:55 +00:00
|
|
|
ARG BRANCH
|
|
|
|
ENV BRANCH=$BRANCH
|
2020-04-04 18:52:29 +00:00
|
|
|
|
2022-03-07 15:49:49 +00:00
|
|
|
RUN apk add --no-cache libxslt libxml2 tzdata postgresql-libs git yarn brotli libssh2 python3 findutils
|
2019-11-16 23:13:30 +00:00
|
|
|
|
2022-03-07 15:49:49 +00:00
|
|
|
USER rails
|
|
|
|
WORKDIR /srv/gems
|
2019-07-26 23:57:11 +00:00
|
|
|
|
2022-03-07 15:49:49 +00:00
|
|
|
COPY --chown=rails:www-data ./Gemfile .
|
|
|
|
COPY --chown=rails:www-data ./Gemfile.lock .
|
2019-07-26 23:57:11 +00:00
|
|
|
|
2021-10-21 23:55:40 +00:00
|
|
|
RUN bundle config set no-cache true
|
|
|
|
RUN bundle config set specific_platform true
|
2020-09-27 17:20:17 +00:00
|
|
|
RUN bundle install --path=./vendor --without='test development'
|
2019-07-26 23:57:11 +00:00
|
|
|
|
2022-03-07 15:49:49 +00:00
|
|
|
COPY --chown=rails:www-data ./.git/ ./.git/
|
|
|
|
|
2019-11-16 23:13:30 +00:00
|
|
|
RUN cd .. && git clone sutty checkout
|
2021-05-19 20:55:55 +00:00
|
|
|
RUN cd ../checkout && git checkout $BRANCH
|
2019-11-16 23:13:30 +00:00
|
|
|
|
2022-03-07 15:49:49 +00:00
|
|
|
WORKDIR /srv/checkout
|
2019-07-26 23:57:11 +00:00
|
|
|
|
2022-03-07 15:49:49 +00:00
|
|
|
RUN rm -rf ./vendor ./node_modules ./tmp/cache ./.git ./test ./doc
|
|
|
|
RUN mv ../gems/vendor ./vendor
|
|
|
|
RUN mv ../gems/.bundle ./.bundle
|
|
|
|
RUN find /srv/checkout/vendor/ruby/2.7.0 -maxdepth 3 -type d -name test -o -name spec -o -name rubocop | xargs -r rm -rf
|
2019-07-29 18:15:23 +00:00
|
|
|
|
2022-03-07 15:49:49 +00:00
|
|
|
FROM registry.nulo.in/sutty/rails:3.13.6-2.7.5
|
2019-07-29 18:15:23 +00:00
|
|
|
ENV RAILS_ENV production
|
2019-07-26 23:57:11 +00:00
|
|
|
|
2020-06-01 21:46:06 +00:00
|
|
|
# Pandoc
|
2022-03-07 15:49:49 +00:00
|
|
|
RUN echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
|
2020-02-06 16:30:21 +00:00
|
|
|
|
2019-07-26 23:57:11 +00:00
|
|
|
# Instalar las dependencias, separamos la librería de base de datos para
|
|
|
|
# poder reutilizar este primer paso desde otros contenedores
|
2022-03-07 15:49:49 +00:00
|
|
|
#
|
2019-07-26 23:57:11 +00:00
|
|
|
# Necesitamos yarn para que Jekyll pueda generar los sitios
|
|
|
|
# XXX: Eliminarlo cuando extraigamos la generación de sitios del proceso
|
|
|
|
# principal
|
2022-03-07 15:49:49 +00:00
|
|
|
RUN apk add --no-cache libxslt libxml2 postgresql-libs libssh2 file \
|
|
|
|
rsync git jpegoptim vips ffmpeg imagemagick pandoc tectonic \
|
|
|
|
oxipng git-lfs openssh-client patch yarn daemonize ruby-webrick
|
|
|
|
|
|
|
|
RUN gem install --no-document --no-user-install foreman
|
|
|
|
|
|
|
|
USER rails
|
|
|
|
|
|
|
|
RUN rm -rf /srv
|
|
|
|
COPY --from=build --chown=rails:www-data /srv/checkout /srv
|
|
|
|
|
2020-04-30 21:06:21 +00:00
|
|
|
RUN rm -rf /srv/http/_sites /srv/http/_deploy
|
|
|
|
RUN ln -s data/_storage /srv/http/_storage
|
|
|
|
RUN ln -s data/_sites /srv/http/_sites
|
|
|
|
RUN ln -s data/_deploy /srv/http/_deploy
|
2020-08-23 00:04:46 +00:00
|
|
|
RUN ln -s data/_private /srv/http/_private
|
2019-07-26 23:57:11 +00:00
|
|
|
|
|
|
|
USER root
|
2022-03-07 15:49:49 +00:00
|
|
|
RUN install -m 640 -o root -g root /srv/monit.conf /etc/monit.d/sutty.conf
|
|
|
|
RUN install -m 755 /srv/entrypoint.sh /usr/local/bin/sutty
|
2019-07-26 23:57:11 +00:00
|
|
|
|
2022-03-07 15:49:49 +00:00
|
|
|
VOLUME "/srv/data"
|
2019-07-26 23:57:11 +00:00
|
|
|
|
|
|
|
EXPOSE 3000
|
2020-09-22 18:17:59 +00:00
|
|
|
EXPOSE 9394
|