-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (29 loc) · 919 Bytes
/
Dockerfile
File metadata and controls
42 lines (29 loc) · 919 Bytes
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
# Use the official Ruby image as the base
FROM ruby:3.0.4
# Install dependencies
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
# Set the working directory
WORKDIR /app
# Copy the Gemfile and Gemfile.lock
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
# Install the gem dependencies
RUN bundle install
# Copy the rest of the application
COPY . /app
# Copy the .env file into the container
COPY .env /app/.env
# Load environment variables using dotenv
RUN echo "source /app/.env" >> /root/.bashrc
# Copy entrypoint script
COPY entrypoint.sh /usr/bin/
# Ensure the entrypoint script is executable
RUN chmod +x /usr/bin/entrypoint.sh
# Precompile assets (if needed)
RUN bundle exec rake assets:precompile
# Expose port 3000 to the Docker host
EXPOSE 3000
# Set the entrypoint
ENTRYPOINT ["entrypoint.sh"]
# Start the Rails server
CMD ["rails", "server", "-b", "0.0.0.0"]