-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
56 lines (43 loc) · 1.81 KB
/
Dockerfile
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
FROM phusion/passenger-full:2.5.1
LABEL maintainer="[email protected]"
# Set correct environment variables.
ENV HOME /home/app
ENV DOCKERIZE_VERSION v0.6.0
# Allow app user to read /etc/container_environment
RUN usermod -a -G docker_env app
# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]
# Use Ruby 3.1.4
RUN bash -lc 'rvm --default use ruby-3.1.4'
# Update installed APT packages
RUN apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold" && \
apt-get install ntp wget tzdata -y && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# install dockerize
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
# Remove unused SSH service
RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh
# Enable Passenger and Nginx and remove the default site
# Preserve env variables for nginx
RUN rm -f /etc/service/nginx/down && \
rm /etc/nginx/sites-enabled/default
COPY vendor/docker/webapp.conf /etc/nginx/sites-enabled/webapp.conf
COPY vendor/docker/00_app_env.conf /etc/nginx/conf.d/00_app_env.conf
# Use Amazon NTP servers
COPY vendor/docker/ntp.conf /etc/ntp.conf
# Copy webapp folder
COPY . /home/app/webapp/
RUN mkdir -p /home/app/webapp/vendor/bundle && \
chown -R app:app /home/app/webapp && \
chmod -R 755 /home/app/webapp
# Install Ruby gems
WORKDIR /home/app/webapp
RUN gem install rubygems-update -v 3.5.6 && \
gem install bundler:2.5.6 && \
su - app -c "bundle config set path 'vendor/bundle'" && \
su - app -c 'cd /home/app/webapp && bundle install'
# Run additional scripts during container startup (i.e. not at build time)
WORKDIR /home/app/webapp
# Expose web
EXPOSE 80