Created Dockerfiles & workflows for application
This commit is contained in:
parent
183ddde941
commit
c03e1cacc0
43
.github/workflows/dockerbuild.yaml
vendored
Normal file
43
.github/workflows/dockerbuild.yaml
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
name: Workflow to execute the full app using Docker Compose
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- docker/docker
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Trivy
|
||||
run: |
|
||||
wget https://github.com/aquasecurity/trivy/releases/download/v0.18.3/trivy_0.18.3_Linux-64bit.deb
|
||||
sudo dpkg -i trivy_0.18.3_Linux-64bit.deb
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Build Frontend Image
|
||||
run: |
|
||||
cd frontend
|
||||
docker build -t "frontend:$GITHUB_RUN_NUMBER" .
|
||||
|
||||
- name: Build Backend Image
|
||||
run: |
|
||||
cd backend
|
||||
docker build -t "backend:$GITHUB_RUN_NUMBER" .
|
||||
|
||||
|
||||
- name: Scanning Docker Images for Vulnerabilities
|
||||
run: |
|
||||
trivy image "frontend:$GITHUB_RUN_NUMBER"
|
||||
trivy image "backend:$GITHUB_RUN_NUMBER"
|
||||
|
||||
|
||||
20
.github/workflows/dockerrun.yaml
vendored
Normal file
20
.github/workflows/dockerrun.yaml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: Workflow to execute the full app using Docker Compose
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- docker/docker
|
||||
|
||||
jobs:
|
||||
docker-compose:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build and run Fronted & Backend using Docker
|
||||
run: |
|
||||
docker-compose up -d
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,6 @@
|
||||
.aider*
|
||||
.env
|
||||
|
||||
# Run logs
|
||||
backend/run_logs/*
|
||||
|
||||
|
||||
9
backend/Dockerfile
Normal file
9
backend/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM python:3.11
|
||||
MAINTAINER label="Rohan Rustagi"
|
||||
WORKDIR /app/backend
|
||||
COPY . .
|
||||
EXPOSE 7000
|
||||
ENV OPENAI_API_KEY
|
||||
RUN pip install poetry && \
|
||||
poetry install
|
||||
CMD ["poetry", "run", "uvicorn", "main:app", "--reload", "--port", "7000"]
|
||||
14
docker-compose.yaml
Normal file
14
docker-compose.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
version: '3'
|
||||
services:
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
ports:
|
||||
- "5173:5173"
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
ports:
|
||||
- "7000:7000"
|
||||
env_file:
|
||||
- backend/.env
|
||||
8
frontend/Dockerfile
Normal file
8
frontend/Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM node:16
|
||||
MAINTAINER label="Rohan Rustagi"
|
||||
WORKDIR /usr/src/app
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn
|
||||
COPY . .
|
||||
EXPOSE 5173
|
||||
CMD ["yarn", "dev"]
|
||||
@ -4,7 +4,7 @@
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"dev": "vite --host",
|
||||
"build": "tsc && vite build",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user