-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
41 lines (30 loc) · 953 Bytes
/
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
# Dockerfile
FROM ruby:3.1.2
# Install dependencies
RUN apt-get update -qq && apt-get install -y postgresql-client
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g yarn@1.21.1
WORKDIR /app
# Install gems
COPY Gemfile Gemfile.lock ./
RUN bundle install --without development test
# Install JavaScript dependencies
COPY package.json yarn.lock ./
RUN yarn install --check-files
# Copy the main application
COPY . ./
# Copy the .env file
COPY .env /app/.env
# Set environment variables
ENV $(cat /app/.env | xargs)
# Precompile assets
RUN SECRET_KEY_BASE=$(grep SECRET_KEY_BASE /app/.env | cut -d '=' -f2) \
RAILS_ENV=production \
bundle exec rails assets:precompile
# Add a script to be executed every time the container starts
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
CMD ["rails", "server", "-b", "0.0.0.0"]