Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add build stage to dockerfile #45

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
services:
gerev:
image: gerev:latest
ports:
- 80:80
volumes:
Expand Down