Skip to content

Commit c5ed2f9

Browse files
committed
Deploy CI CD on Test Server
1 parent 00ce37e commit c5ed2f9

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

Dockerfile

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,16 @@
22
FROM node:18 as build-stage
33

44
# Set working directory for frontend
5-
WORKDIR /code
5+
WORKDIR /app/frontend
66

77
# Copy frontend package files
8-
COPY ./Frontend/ecommerce_inventory/package.json ./Frontend/ecommerce_inventory/package-lock.json /code/
9-
10-
# List contents (optional, for verification)
11-
RUN ls -l /code
8+
COPY ./Frontend/ecommerce_inventory/package.json ./Frontend/ecommerce_inventory/package-lock.json ./
129

1310
# Install frontend dependencies
1411
RUN npm install
1512

1613
# Copy frontend source code
17-
COPY ./Frontend/ecommerce_inventory /code/
18-
COPY ./Frontend/ /code/Frontend/
19-
20-
# List contents (optional, for verification)
21-
RUN ls -l /code
14+
COPY ./Frontend/ecommerce_inventory .
2215

2316
# Build frontend (adjust this based on your React build process)
2417
RUN npm run build
@@ -34,26 +27,16 @@ ENV PYTHONUNBUFFERED 1
3427
WORKDIR /code
3528

3629
# Copy backend requirements file
37-
COPY ./Backend/EcommerceInventory/requirements.txt /code/
38-
39-
# List contents (optional, for verification)
40-
RUN ls -l /code
30+
COPY ./Backend/EcommerceInventory/requirements.txt .
4131

4232
# Install backend dependencies
4333
RUN pip install -r requirements.txt
4434

4535
# Copy built frontend to Django static files directory
46-
COPY --from=build-stage /code/build /code/static/
47-
48-
# List contents (optional, for verification)
49-
RUN ls -l /code/static
36+
COPY --from=build-stage /app/frontend/build ./static
5037

5138
# Copy Django project files
52-
COPY ./Backend/EcommerceInventory /code/
53-
COPY ./Frontend/ /code/Frontend/
54-
55-
# List contents (optional, for verification)
56-
RUN ls -l /code
39+
COPY ./Backend/EcommerceInventory .
5740

5841
# Collect static files
5942
RUN python manage.py collectstatic --no-input

docker-compose.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ services:
44
web:
55
build:
66
context: .
7-
dockerfile: Dockerfile # Adjust the path to your Dockerfile
8-
command: gunicorn EcommerceInventory.wsgi:application --bind 0.0.0.0:80
7+
dockerfile: Dockerfile
8+
command: python manage.py runserver 0.0.0.0:80
9+
volumes:
10+
- ./Backend/EcommerceInventory:/code
11+
- ./Frontend/ecommerce_inventory/build:/code/static # Assuming React build output is in /code/static
912
ports:
1013
- "80:80"
14+
environment:
15+
- DEBUG=0 # Set DEBUG to 0 for production-like environments
1116
depends_on:
1217
- db
1318

0 commit comments

Comments
 (0)