Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -31
Dockerfile
CHANGED
|
@@ -1,42 +1,25 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
| 2 |
WORKDIR /app
|
| 3 |
|
| 4 |
-
# Install
|
| 5 |
-
RUN apt-get update && apt-get install -y
|
| 6 |
-
python3 \
|
| 7 |
-
python3-pip \
|
| 8 |
-
python3-venv \
|
| 9 |
-
git \
|
| 10 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
# Clone the repository
|
| 13 |
-
RUN git clone https://github.com/KenKout/CO3001.git
|
| 14 |
|
| 15 |
# Install Python dependencies
|
| 16 |
-
RUN
|
| 17 |
-
|
| 18 |
-
# Copy database
|
| 19 |
-
COPY studyspace.db .
|
| 20 |
-
|
| 21 |
-
# Set environment variables
|
| 22 |
-
ENV NEXT_PUBLIC_API_URL=https://co3001-api.thenduy.com/api
|
| 23 |
|
| 24 |
-
|
| 25 |
-
WORKDIR /app/frontend
|
| 26 |
-
RUN npm install
|
| 27 |
-
RUN npm run build -- --no-lint
|
| 28 |
|
| 29 |
-
|
| 30 |
-
RUN
|
| 31 |
-
|
| 32 |
-
# Set environment variables
|
| 33 |
-
ENV PYTHONUNBUFFERED=1
|
| 34 |
-
ENV NODE_ENV=production
|
| 35 |
-
ENV PORT=3000
|
| 36 |
-
|
| 37 |
-
# Make entrypoint script executable
|
| 38 |
-
RUN chmod +x /app/entrypoint.sh
|
| 39 |
|
|
|
|
| 40 |
EXPOSE 8000
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container to /app
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install git and other dependencies
|
| 8 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Clone the repository
|
| 11 |
+
RUN git clone https://github.com/KenKout/CO3001.git /app
|
| 12 |
|
| 13 |
# Install Python dependencies
|
| 14 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
RUN chmod 777 /app
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
COPY studyspace.db .
|
| 19 |
+
RUN chmod 777 studyspace.db
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
# Expose the port that Uvicorn will run on
|
| 22 |
EXPOSE 8000
|
| 23 |
|
| 24 |
+
# Run Uvicorn when the container launches
|
| 25 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|