-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
55 lines (40 loc) · 1.24 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
# Stage 1: Build the React frontend
FROM node:16 AS frontend-builder
WORKDIR /app
# Copy and install frontend dependencies
COPY package*.json ./
RUN npm install
# Copy the rest of the frontend code
COPY . .
# Build the frontend assets
RUN npm run build
# Stage 2: Build the Sinatra backend
FROM ruby:3.2.2-slim
# Install necessary packages
RUN apt-get update -qq && apt-get install -y \
build-essential \
libsqlite3-dev \
openssl \
libffi-dev \
libpq-dev
WORKDIR /usr/src/app
# Copy and install backend dependencies
COPY Gemfile* ./
RUN bundle config set without 'development test' && bundle install
# Copy the backend code
COPY . .
# Remove any existing development databases
RUN rm -f db/development*
# Copy built frontend assets from the frontend builder stage
COPY --from=frontend-builder /app/public ./public
# Expose the application port
EXPOSE 9292
# Set environment variables
ENV RACK_ENV=production
ENV TUDUDI_INTERNAL_SSL_ENABLED=false
# Generate SSL certificates
RUN mkdir -p certs && \
openssl req -x509 -newkey rsa:4096 -keyout certs/server.key -out certs/server.crt \
-days 365 -nodes -subj '/CN=localhost'
# Run database migrations and start the Puma server
CMD rake db:migrate && puma -C app/config/puma.rb