-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from ZJUEarthData/web
feat: allow developer to deploy the application using Docker.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Stage 1: Build the frontend | ||
FROM node:latest as frontend-builderge | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Install frontent dependencies | ||
COPY geochemistrypi/frontend/package.json /app/ | ||
RUN yarn install | ||
|
||
# Stage 2: Build the backend | ||
FROM python:3.9-slim AS backend-builder | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Install backend dependencies | ||
COPY requirements/production.txt /app/ | ||
RUN pip install -r production.txt | ||
|
||
# Special case for Debian OS, update package lists and install Git and Node.js | ||
RUN apt-get update && apt-get install -y libgomp1 git | ||
RUN apt-get update && apt-get install -y nodejs | ||
RUN apt-get update && apt-get install -y npm | ||
|
||
# Install Yarn | ||
RUN npm install -g yarn | ||
|
||
# Copy the rest of the code | ||
COPY . . | ||
|
||
# Expose the port | ||
EXPOSE 8000 3001 | ||
|
||
# Mount the volume | ||
VOLUME /app | ||
|
||
# Dummy CMD to prevent container from exiting immediately | ||
CMD ["tail", "-f", "/dev/null"] |