Updated development Dockerfile and entrypoint per Gemini's recommendations
This commit is contained in:
@@ -1,16 +1,27 @@
|
|||||||
FROM ruby:3.4
|
FROM ruby:3.4-slim
|
||||||
|
|
||||||
RUN gem install bundler
|
# 1. Install essential build tools for gems like 'pg' or 'sqlite3'
|
||||||
|
RUN apt-get update -qq && apt-get install -y \
|
||||||
|
build-essential \
|
||||||
|
libpq-dev \
|
||||||
|
curl \
|
||||||
|
git
|
||||||
|
|
||||||
WORKDIR /usr/src/game-data
|
WORKDIR /usr/src/game-data
|
||||||
|
|
||||||
COPY Gemfile Gemfile.l*ck ./
|
# 2. Set environment variables for the Gem volume we discussed
|
||||||
|
ENV BUNDLE_PATH=/usr/local/bundle \
|
||||||
|
BUNDLE_BIN=/usr/local/bundle/bin \
|
||||||
|
PATH=/usr/local/bundle/bin:$PATH
|
||||||
|
|
||||||
RUN bundle check || bundle install
|
# 3. Copy Gemfile first to leverage layer caching
|
||||||
|
COPY Gemfile Gemfile.lock ./
|
||||||
RUN gem install rake
|
RUN bundle install
|
||||||
|
|
||||||
|
# 4. Copy the application code
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
ENTRYPOINT ["bash", "entrypoints/dev.sh"]
|
# 5. Make sure your entrypoint script is executable
|
||||||
|
RUN chmod +x entrypoints/dev.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["bash", "entrypoints/dev.sh"]
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ ! -f ./data/gamedata.db ]; then
|
# Run the migrations to make sure the DB is up-to-date
|
||||||
rake db:migrate
|
echo 'Checking database status...'
|
||||||
fi
|
rake db:migrate
|
||||||
|
|
||||||
|
# Start the HTTP server
|
||||||
|
echo 'Starting development server...'
|
||||||
rake server:dev
|
rake server:dev
|
||||||
|
|||||||
Reference in New Issue
Block a user