running app with HMR

This commit is contained in:
Georges-Antoine Assi
2025-06-18 23:23:09 -04:00
parent f5f3556da3
commit f4caf4c7da
3 changed files with 36 additions and 33 deletions

View File

@@ -16,10 +16,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libmariadb-dev \
libpq-dev \
libffi-dev \
libpq-dev \
musl-dev \
curl \
ca-certificates \
libmagic-dev \
p7zip \
tzdata \
libbz2-dev \
libssl-dev \
libreadline-dev \
libsqlite3-dev \
zlib1g-dev \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
@@ -37,6 +47,19 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | b
&& nvm alias default 18.20.8
ENV PATH="$NVM_DIR/versions/node/v18.20.8/bin:$PATH"
# Build and install RAHasher (optional for RA hashes)
RUN git clone --recursive --branch 1.8.0 --depth 1 https://github.com/RetroAchievements/RALibretro.git /tmp/RALibretro
WORKDIR /tmp/RALibretro
RUN sed -i '22a #include <ctime>' ./src/Util.h \
&& make HAVE_CHD=1 -f ./Makefile.RAHasher \
&& cp ./bin64/RAHasher /usr/bin/RAHasher
RUN rm -rf /tmp/RALibretro
# Install frontend dependencies
COPY frontend/package.json /app/frontend/
WORKDIR /app/frontend
RUN npm install
# Set working directory
WORKDIR /app
@@ -51,31 +74,12 @@ RUN pip3 install pipx poetry \
# Make poetry available to all users
ENV PATH="/usr/local/bin:$HOME/.local/bin:${PATH}"
# Install Trunk CLI
RUN curl https://get.trunk.io -fsSL | bash
# Build and install RAHasher (optional for RA hashes)
RUN git clone --recursive --branch 1.8.0 --depth 1 https://github.com/RetroAchievements/RALibretro.git /tmp/RALibretro
WORKDIR /tmp/RALibretro
RUN sed -i '22a #include <ctime>' ./src/Util.h \
&& make HAVE_CHD=1 -f ./Makefile.RAHasher \
&& cp ./bin64/RAHasher /usr/bin/RAHasher
WORKDIR /app
RUN rm -rf /tmp/RALibretro
# Copy project files (including pyproject.toml and poetry.lock)
COPY pyproject.toml poetry.lock* .env .python-version ./
COPY pyproject.toml poetry.lock* .env .python-version /app/
# Install Python dependencies
RUN poetry sync
# Copy frontend files
COPY frontend/package*.json ./frontend/
# Install frontend dependencies
RUN cd frontend && npm ci
# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

View File

@@ -6,14 +6,21 @@ services:
context: .
dockerfile: Dockerfile
container_name: romm-dev
env_file: .env
environment:
- REDIS_HOST=romm-valkey-dev
- DB_HOST=romm-db-dev
- ROMM_BASE_PATH=/app/romm
ports:
- "8000:8000" # Backend API
- "3000:3000" # Frontend dev server
volumes:
- ./backend:/app/backend
- /app/backend/romm_mock # Empty directory
- ./frontend:/app/frontend
- ./romm_mock:/app/romm_mock
- ./romm_test:/app/romm_test
- /app/frontend/node_modules # Empty directory
- /app/frontend/dist # Empty directory
- ./romm_mock:/app/romm
depends_on:
- romm-db-dev
- romm-valkey-dev

View File

@@ -1,14 +1,6 @@
#!/bin/bash
set -e
# Create mock directory structure if it doesn't exist
mkdir -p /app/romm_mock/library/roms/switch
touch /app/romm_mock/library/roms/switch/metroid.xci
mkdir -p /app/romm_mock/resources
mkdir -p /app/romm_mock/assets
mkdir -p /app/romm_mock/config
touch /app/romm_mock/config/config.yml
# Copy env template if .env doesn't exist
if [[ ! -f /app/.env ]]; then
cp /app/env.template /app/.env
@@ -17,8 +9,8 @@ fi
# Create symlinks for frontend
mkdir -p /app/frontend/assets/romm
ln -sf /app/backend/romm_mock/resources /app/frontend/assets/romm/resources
ln -sf /app/backend/romm_mock/assets /app/frontend/assets/romm/assets
ln -sf /app/romm_mock/resources /app/frontend/assets/romm/resources
ln -sf /app/romm_mock/assets /app/frontend/assets/romm/assets
# Start all services in the background
cd /app/backend