-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
54 lines (41 loc) · 1.64 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
FROM ruby:3.1.1-slim
ENV DEBIAN_FRONTEND=noninteractive \
RAILS_ENV=production \
BUNDLE_WITHOUT=development:test \
BUNDLE_DEPLOYMENT=true \
BUNDLE_PATH=/usr/local/bundle
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
libssl-dev \
zlib1g-dev \
p7zip \
libpq-dev \
libicu-dev \
imagemagick \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && apt-get install -y nodejs && \
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null && \
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y yarn
WORKDIR /app
COPY Gemfile /app
COPY Gemfile.lock /app
RUN bundle install --without development test
COPY package.json /app
COPY package-lock.json /app
RUN npm ci
COPY . /app
RUN RAILS_ENV=production SECRET_KEY_BASE=build bin/rails assets:precompile
RUN rm -rf node_modules tmp/cache && \
apt-get autoremove -y && apt-get clean
EXPOSE 3000
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
HEALTHCHECK CMD curl -f http://localhost:3000/api || exit 1
CMD ["bin/rails", "server", "-b", "0.0.0.0"]