-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
67 lines (52 loc) · 1.83 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Base image
FROM ruby:3.2.2
# startTODO: WORKAROUND FOR MALFORMED MAWSITSIT GEM COMPILATION
# Install dependencies
RUN apt-get update -qq && \
apt-get install -y build-essential libpq-dev curl llvm-dev libclang-dev clang
# Install Rust (for building gems with native extensions that use Rust)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Verify installation and locate libclang
RUN ldconfig -p | grep libclang
# Find and set the correct LIBCLANG_PATH
RUN echo "Verifying possible libclang paths" && \
ldconfig -p | grep libclang && \
if [ -d "/usr/lib/llvm-10/lib" ]; then \
echo "Setting LIBCLANG_PATH to /usr/lib/llvm-10/lib"; \
export LIBCLANG_PATH="/usr/lib/llvm-10/lib"; \
elif [ -d "/usr/lib/x86_64-linux-gnu" ]; then \
echo "Setting LIBCLANG_PATH to /usr/lib/x86_64-linux-gnu"; \
export LIBCLANG_PATH="/usr/lib/x86_64-linux-gnu"; \
else \
echo "Could not find libclang path"; \
exit 1; \
fi
# endTODO: WORKAROUND FOR MALFORMED MAWSITSIT GEM COMPILATION
WORKDIR /app
# Install dependencies
RUN apt-get update -qq && \
apt-get install -y build-essential \
libpq-dev \
nodejs \
npm
# Install yarn
RUN npm install -g yarn
# Copy the Gemfile and Gemfile.lock into the container
COPY Gemfile Gemfile.lock ./
# Install gems
RUN gem install bundler:2.2.23 && \
bundle install
# Copy the application code into the container
COPY . .
# Set environment variables
ENV RAILS_ENV=production
ENV RAILS_SERVE_STATIC_FILES=true
ENV RAILS_LOG_TO_STDOUT=true
# Precompile assets
RUN yarn install
RUN bundle exec rake assets:precompile
# Expose port 3000
EXPOSE 3000
# Start the Rails server
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]