-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (43 loc) · 1.39 KB
/
Dockerfile
File metadata and controls
56 lines (43 loc) · 1.39 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
FROM ruby:3.4.8-slim
# Set environment variables
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
wget \
gnupg \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js (required for Playwright)
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs
# Set working directory
WORKDIR /app
# Copy Gemfile and Gemfile.lock first for better caching
COPY Gemfile Gemfile.lock ./
# Install Ruby gems
RUN bundle config set --local deployment 'true' \
&& bundle config set --local without 'development test' \
&& bundle install
# Install Playwright and browsers
RUN npm init -y \
&& npm install playwright@1.46.0 \
&& npx playwright install --with-deps chromium
# Create data directory and set permissions
RUN mkdir -p /app/data /app/data/thumbnails \
&& chmod 755 /app/data /app/data/thumbnails
# Copy application code
COPY . .
# Create a non-root user for security
RUN useradd --create-home --shell /bin/bash app \
&& chown -R app:app /app
USER app
# Expose port
EXPOSE 4567
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:4567/health || exit 1
# Start the application
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]