mirror of
https://github.com/xlorepdarkhelm/numinar-coding-project.git
synced 2026-09-05 23:48:26 -04:00
39
backend/Dockerfile
Normal file
39
backend/Dockerfile
Normal file
@@ -0,0 +1,39 @@
|
||||
# The Python version can be passed as a build argument.
|
||||
# Default is set to Python 3.13.
|
||||
ARG PYTHON_VERSION=3.13
|
||||
|
||||
# Builder stage
|
||||
# This stage is used to install dependencies using Poetry and export them to a requirements.txt file.
|
||||
FROM python:${PYTHON_VERSION}-slim as builder
|
||||
|
||||
# Install Poetry in the builder stage
|
||||
RUN pip install --no-cache-dir poetry
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the Poetry configuration files
|
||||
COPY pyproject.toml poetry.lock ./
|
||||
|
||||
# Export dependencies to requirements.txt
|
||||
# This will create a requirements.txt file with the dependencies listed in pyproject.toml
|
||||
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes --no-dev
|
||||
|
||||
# Final stage
|
||||
# Use a fresh Python image to keep the final image small
|
||||
FROM python:${PYTHON_VERSION}-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the requirements.txt generated in the builder stage and install dependencies
|
||||
COPY --from=builder /app/requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the project source code
|
||||
COPY src/ src/
|
||||
|
||||
# Start fastapi application using uvicorn
|
||||
EXPOSE 8000
|
||||
ENV PYTHONPATH=/app/src
|
||||
CMD ["uvicorn", "backend:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||
1374
backend/poetry.lock
generated
1374
backend/poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -16,8 +16,10 @@ classifiers = [
|
||||
Changelog = "https://github.com/xlorepdarkhelm/backend/releases"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.7"
|
||||
python = "^3.8"
|
||||
click = ">=8.0.1"
|
||||
fastapi = {extras = ["standard"], version = "^0.116.1"}
|
||||
sqlmodel = "^0.0.24"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
pyyaml = ">=6.0.1"
|
||||
|
||||
38
frontend/Dockerfile
Normal file
38
frontend/Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
# Build stage
|
||||
FROM node:24.6.0 AS builder
|
||||
|
||||
# Setting working directory for build
|
||||
WORKDIR /app
|
||||
|
||||
# Copying package.json and package-lock.json to leverage Docker cache
|
||||
COPY package*.json ./
|
||||
|
||||
# Copying TypeScript configuration
|
||||
COPY tsconfig.json ./
|
||||
|
||||
# Installing dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copying the rest of the application code
|
||||
COPY . .
|
||||
|
||||
# Building the TypeScript React app for production
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
FROM node:24.6.0-slim
|
||||
|
||||
# Setting working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Installing serve to run the production build
|
||||
RUN npm install -g serve
|
||||
|
||||
# Copying only the build output from the builder stage
|
||||
COPY --from=builder /app/build ./build
|
||||
|
||||
# Exposing the port the app will run on
|
||||
EXPOSE 3000
|
||||
|
||||
# Starting the server to serve the built React app
|
||||
CMD ["serve", "-s", "build", "-l", "3000"]
|
||||
Reference in New Issue
Block a user