Skip to content

Commit 797f7b9

Browse files
committed
chore(): add dockerfile
1 parent 89aee6e commit 797f7b9

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM ruby:2.7.5
2+
3+
WORKDIR /app
4+
COPY package.json yarn.lock /app/
5+
COPY Gemfile Gemfile.lock /app/
6+
COPY Aptfile /app/
7+
COPY .node-version .ruby-version /app/
8+
9+
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client
10+
11+
# Install Buildpack dependencies
12+
RUN xargs -a Aptfile apt-get install -y
13+
RUN apt-get install libvips
14+
15+
# Install Ruby dependencies
16+
RUN BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ") && \
17+
gem install bundler:$BUNDLER_VERSION && \
18+
bundle _$(echo $BUNDLER_VERSION)_ install
19+
20+
# Install yarn dependencies
21+
RUN curl -sL https://deb.nodesource.com/setup_$(cat .node-version).x | bash - && \
22+
apt-get install -y nodejs && \
23+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
24+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
25+
apt update && apt install yarn && \
26+
yarn install --frozen-lockfile
27+
COPY . /app
28+
29+
RUN groupadd --system --gid 1000 rails && \
30+
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
31+
chown -R 1000:1000 db log storage tmp
32+
USER 1000:1000
33+
34+
# Deployment options
35+
ENV RAILS_LOG_TO_STDOUT="1" \
36+
RAILS_SERVE_STATIC_FILES="true"
37+
38+
# Start the main process.
39+
EXPOSE 3000

0 commit comments

Comments
 (0)