Skip to content

Commit

Permalink
Added docker file for react and backend
Browse files Browse the repository at this point in the history
  • Loading branch information
SelamT94 committed Jun 26, 2024
1 parent 2a7645c commit 6d4b801
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code into the container
COPY . .

# Make port 80 available to the world outside this container
EXPOSE 80

# Run the application
CMD ["python", "run.py"]
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3.8'

services:
backend:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/app
ports:
- "8000:80"
environment:
- APP_ENV=development
command: python run.py

frontend:
build:
context: ./frontend
dockerfile: Dockerfile
volumes:
- ./frontend:/app
ports:
- "3000:3000"
environment:
- NODE_ENV=development
command: serve -s build
26 changes: 26 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Use the official Node.js image as a parent image
FROM node:14

# Set the working directory in the container
WORKDIR /app

# Copy the package.json and package-lock.json files
COPY package*.json ./

# Install any needed packages
RUN npm install

# Copy the rest of the application code into the container
COPY . .

# Build the app
RUN npm run build

# Install serve to serve the build
RUN npm install -g serve

# Make port 3000 available to the world outside this container
EXPOSE 3000

# Serve the app
CMD ["serve", "-s", "build"]

0 comments on commit 6d4b801

Please sign in to comment.