-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (51 loc) · 1.55 KB
/
Dockerfile
File metadata and controls
68 lines (51 loc) · 1.55 KB
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
68
# Use the official Ruby image as a base
FROM ruby:3.3.7
ENV BUNDLE_PATH /gems
# Install dependencies
RUN apt-get update -qq && apt-get install -yq --no-install-recommends \
build-essential \
gnupg2 \
less \
git \
libpq-dev \
libxml2-dev \
libxslt-dev \
postgresql-client \
libvips \
curl \
graphviz \
clamdscan \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Configure clamdscan to connect to clamav service
RUN mkdir -p /etc/clamav && \
echo "TCPSocket 3310" > /etc/clamav/clamd.conf && \
echo "TCPAddr clamav" >> /etc/clamav/clamd.conf
# Install Node.js (LTS version)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN gem update --system && gem install bundler
# Set the working directory
WORKDIR /app
# Copy the Gemfile and Gemfile.lock into the working directory
COPY Gemfile Gemfile.lock ./
RUN bundle config build.nokogiri --use-system-libraries
# Install the gems
RUN bundle install
# Copy package.json for npm install
COPY package.json ./
# Install npm dependencies
RUN npm install
# Copy the rest of the application code into the working directory
COPY . .
# Build JavaScript assets
RUN npm run build
# Create non-root user for security
RUN useradd -m -u 1000 harmonic && \
chown -R harmonic:harmonic /app /gems
# Switch to non-root user
USER harmonic
# Expose the port the app will run on
EXPOSE 3000
# Start the application server
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]