Skip to content

Commit

Permalink
Dockerize the project
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiramtilakiiit committed Jun 13, 2024
1 parent bbe8f45 commit f03c5cd
Show file tree
Hide file tree
Showing 22 changed files with 65 additions and 7 deletions.
15 changes: 15 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
frontend:
build:
context: frontend
target: prod
args:
- VITE_BACKEND_URL=${VITE_BACKEND_URL}
container_name: frontend
volumes:
- ./website:/usr/src/app/dist
depends_on:
- backend
backend:
build:
context: backend
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
frontend:
build:
context: frontend
target: dev
#args:
#- VITE_BACKEND_URL=${VITE_BACKEND_URL}
ports:
- 80:80
#depends_on:
# - backend
#backend:
# build:
# context: backend
1 change: 1 addition & 0 deletions down.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker compose -p dev down
16 changes: 16 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:latest as builder

WORKDIR /usr/src/app
ENV PATH /usr/src/node_modules/.bin:$PATH
ARG VITE_BACKEND_URL
ENV VITE_BACKEND_URL=$VITE_BACKEND_URL

COPY package.json ./
RUN npm install
COPY . .

FROM builder as dev
CMD ["npm", "run", "dev"]

FROM builder as prod-builder
RUN npm run build
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions frontend/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
base: '/',
plugins: [react()],
preview: {
port: 80,
strictPort: true,
},
server: {
port: 80,
strictPort: true,
host: true,
origin: 'http://0.0.0.0:80',
},
});
1 change: 1 addition & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker compose -p dev up --build
7 changes: 0 additions & 7 deletions vite.config.js

This file was deleted.

0 comments on commit f03c5cd

Please sign in to comment.