This repository has been archived by the owner on Nov 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdockerfile_rails
executable file
·73 lines (54 loc) · 2.3 KB
/
dockerfile_rails
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM ruby:2.7.2
# https://stackoverflow.com/a/63455300/2595513
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/' /etc/ssl/openssl.cnf
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Utilities
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl git sudo vim telnet iputils-ping ssh openssh-server cron
# executable JS is required
RUN cd ~ \
&& curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh \
&& bash nodesource_setup.sh\
&& apt install nodejs\
&& nodejs -v
# See https://github.com/phusion/passenger-docker/issues/195#issuecomment-321868848
RUN export DEBIAN_FRONTEND=noninteractive; \
apt-get install -y tzdata
# for postgres
RUN apt-get install -y libpq-dev
# for nokogiri
RUN apt-get install -y libxml2-dev libxslt1-dev
# for imagemagik
RUN apt-get install -y imagemagick
# For local tunneling
RUN mkdir /root/.ssh/; \
echo 'NoHostAuthenticationForLocalhost yes' > /root/.ssh/config
RUN echo "root:root" | chpasswd; \
mkdir -p /home/clara;
#RUN echo "service ssh restart" > ~/allow_local_tunnel.sh; \
RUN echo "yes y | ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ''" >> ~/allow_local_tunnel.sh; \
echo "cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys" >> ~/allow_local_tunnel.sh; \
echo "chmod og-wx ~/.ssh/authorized_keys" >> ~/allow_local_tunnel.sh; \
chmod u+x ~/allow_local_tunnel.sh; \
sh ~/allow_local_tunnel.sh;
COPY rails/Gemfile* /root/
#RUN cd /root; \
# curl https://raw.githubusercontent.com/StartupsPoleEmploi/clara/20.37.0/Gemfile -o Gemfile; \
# curl https://raw.githubusercontent.com/StartupsPoleEmploi/clara/20.37.0/Gemfile.lock -o Gemfile.lock
RUN mkdir -p /var/git/ara.git
WORKDIR /var/git/ara.git/
RUN git clone https://github.com/StartupsPoleEmploi/clara/ -b master;
ENV RUBYOPT="-KU -E utf-8:utf-8"
ARG ENV_TYPE=${ENV_TYPE:-production}
ENV ENV_TYPE=$ENV_TYPE
RUN echo "** Environment: $ENV_TYPE **";
# Launch cron jobs (for db dump everyday)
CMD ln -sf /home/env/$ENV_TYPE/.env "/home/clara/.env"; \
service ssh start; \
cd /var/git/ara.git/clara/rails; \
git pull; \
rm -f /var/www/ara/shared/tmp/sockets/pumactl.sock /var/www/ara/deploy.lock; \
bundle install; \
bundle exec mina production2 setup; \
bundle exec mina production2 deploy; \
sleep infinity