From 3892d12cbcfcca50cd33ce1ba4293e7da8090a1e Mon Sep 17 00:00:00 2001 From: f Date: Mon, 18 Nov 2019 14:10:05 -0300 Subject: [PATCH] contenedor --- Dockerfile | 15 +++++++-------- monit.conf | 3 ++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index e99c3fc..6c9855c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # el mismo repositorio de trabajo. Cuando tengamos CI/CD algunas cosas # como el tarball van a tener que cambiar porque ya vamos a haber hecho # un clone/pull limpio. -FROM alpine:3.9 as build +FROM alpine:3.10 as build MAINTAINER "f " ARG RAILS_MASTER_KEY @@ -24,7 +24,7 @@ RUN cd /usr/lib/ruby/2.5.0 && patch -Np 0 -i /tmp/rubygems-platform-musl.patch # Agregar el usuario RUN addgroup -g 82 -S www-data RUN adduser -s /bin/sh -G www-data -h /home/app -D app -RUN install -dm750 -o app -g www-data /home/app/web +RUN install -dm750 -o app -g www-data /home/app/sutty RUN gem install --no-document bundler:2.0.2 # Empezamos con la usuaria app @@ -47,8 +47,8 @@ RUN cd .. && git clone sutty checkout WORKDIR /home/app/checkout # Traer las gemas: -RUN mv ../web/vendor ./vendor -RUN mv ../web/.bundle ./.bundle +RUN mv ../sutty/vendor ./vendor +RUN mv ../sutty/.bundle ./.bundle # Instalar secretos COPY --chown=app:root ./config/credentials.yml.enc ./config/ @@ -99,10 +99,9 @@ COPY --from=build --chown=app:www-data /home/app/checkout /srv/http USER root # Sincronizar los assets a un directorio compartido -COPY ./sync_assets.sh /usr/local/bin/sync_assets -RUN chmod 755 /usr/local/bin/sync_assets -# Instalar la configuraciĆ³n de monit y comprobarla -RUN install -m 640 -o root -g root ./monit.conf /etc/monit.d/sutty.conf +RUN install -m 755 /srv/http/sync_assets.sh /usr/local/bin/sync_assets +# Instalar la configuraciĆ³n de monit +RUN install -m 640 -o root -g root /srv/http/monit.conf /etc/monit.d/sutty.conf # Mantener estos directorios! VOLUME "/srv/http/_deploy" diff --git a/monit.conf b/monit.conf index 4d34d69..b612016 100644 --- a/monit.conf +++ b/monit.conf @@ -1,5 +1,6 @@ check process sutty with pidfile /srv/http/tmp/puma.pid - start program = "/bin/sh -c 'cd /srv/http && foreman start migrate && foreman start sutty'" as uid app + start program = "/bin/sh -c 'cd /srv/http && foreman start migrate && foreman start sutty'" + as uid "app" and gid "www-data" stop program = "/bin/sh -c 'cat /srv/http/tmp/puma.pid | xargs kill'" check program sync_assets