-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (37 loc) · 1.12 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
# Set base image and working directory
FROM ruby:3.3
# Install necessary packages, including curl and PostgreSQL client
RUN apt-get update -qq && apt-get install -y \
curl \
postgresql-client \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Yarn globally
RUN npm install -g yarn
# Set environment variables
ENV RAILS_ENV=development
ENV APP_HOME=/app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
# Install esbuild globally
RUN npm install -g esbuild
# Copy Gemfile and Gemfile.lock first
COPY Gemfile Gemfile.lock $APP_HOME/
# Install bundler and Ruby dependencies
RUN gem install bundler -v 2.5.20
RUN bundle install --jobs 30
# Copy package.json and package-lock.json before running yarn install
COPY package.json $APP_HOME/
# Install JS dependencies
RUN yarn install
# Now copy the rest of the application
COPY . $APP_HOME/
# Precompile assets
RUN yarn build
RUN yarn build:css
# Expose the app port
EXPOSE 3000
# Start the server
CMD ["bash", "-c", "rm -f /app/tmp/pids/server.pid && bundle exec rails server -b 0.0.0.0"]