diff --git a/Dockerfile b/Dockerfile index de7ead5..f01dc39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,52 @@ +# Stage 1: Build the React Native app +FROM node:lts-alpine as build-stage + +WORKDIR /ui + +# Copy the package.json and package-lock.json files +COPY ./ui/package*.json ./ + +# Install dependencies +RUN npm ci + +# Copy the rest of the app +COPY ./ui . + +# Build the app +RUN npm run build + +# Stage 2: Set up Python environment FROM python:3.9 ENV DOCKER_DEPLOYMENT=1 +# Install torch RUN pip install torch +# Install Python requirements COPY ./app/requirements.txt /tmp/requirements.txt - RUN pip install -r /tmp/requirements.txt +# Set telemetry environment variable ENV CAPTURE_TELEMETRY=1 +# Cache the models COPY ./app/models.py /tmp/models.py - -# cache the models RUN python3 /tmp/models.py +# Copy the Python app COPY ./app /app -COPY ./ui/build /ui +# Copy the built React Native app from the build stage +COPY --from=build-stage /ui/build /ui +# Copy run script COPY ./run.sh /app/run.sh +# Set the working directory WORKDIR /app +# Create volume for storage VOLUME [ "/opt/storage" ] EXPOSE 80 diff --git a/docker-compose.yaml b/docker-compose.yaml index 87efb9a..042f99e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,5 @@ services: gerev: - image: gerev:latest ports: - 80:80 volumes: