Cleanup old code
This commit is contained in:
parent
dfcb97a355
commit
60e1b0a43c
14 changed files with 63 additions and 215 deletions
40
Dockerfile
40
Dockerfile
|
|
@ -1,23 +1,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
|
||||
|
||||
RUN apt-get update -qq && apt-get install -y build-essential libsqlite3-dev openssl libffi-dev libpq-dev
|
||||
# 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'
|
||||
openssl req -x509 -newkey rsa:4096 -keyout certs/server.key -out certs/server.crt \
|
||||
-days 365 -nodes -subj '/CN=localhost'
|
||||
|
||||
CMD rake db:migrate; puma -C app/config/puma.rb
|
||||
# Run database migrations and start the Puma server
|
||||
CMD rake db:migrate && puma -C app/config/puma.rb
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue