Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devops push #37

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# syntax=docker/dockerfile:1

#base image
FROM python:3.9

#
WORKDIR /code

#
COPY ./requirements.txt /code/requirements.txt

#
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

#
COPY . /code/app

#
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
16 changes: 16 additions & 0 deletions Backend/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"listeners": {
"*:80": {
"pass": "applications/fastapi"
}
},

"applications": {
"fastapi": {
"type": "python 3.9",
"path": "/build/app/",
"module": "app.main",
"callable": "app"
}
}
}
2 changes: 1 addition & 1 deletion Backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pytest==7.2.0
python-dateutil==2.8.1
python-multipart==0.0.5
pytz==2022.1
pywin32==227
#pywin32==227
pywinpty==0.5.7
pyzmq==18.1.1
qtconsole==4.6.0
Expand Down
66 changes: 66 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
version: '3.9'

services:
backend:
build:
context: ./Backend
volumes:
- type: bind
source: ./Backend
target: /app
networks:
- appnet
environment:
DB_HOST: db
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: postgres
ports:
- "8001:8001"
depends_on:
- db

#frontend
frontend:
build:
context: ./frontend
ports:
- "3001:3000"
networks:
- appnet
restart: always

# database
db:
image: postgres:latest
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- 5432:5432
volumes:
- db:/var/lib/postgresql/data
networks:
- appnet

# used to have a UI for the database
adminer:
image: adminer
restart: always
depends_on:
- db
ports:
- 8081:8080
networks:
- appnet

# link all docker containers to the same image
networks:
appnet:
driver: bridge
# bind volumes
volumes:
db:
driver: local
20 changes: 20 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# syntax=docker/dockerfile:1
# This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
ARG NODE_IMAGE_VERSION=19-alpine3.15
FROM node:current-alpine
ENV NODE_ENV=production
LABEL name='Chidubem' email='[email protected]'

# Create a working directory for Docker to use
WORKDIR /app

# Copy any file dependecies to the image
COPY package*.json ./

# Install app dependencies
RUN yarn install --production

# Bundle app source
COPY . .
CMD ["yarn", "start"]
EXPOSE 3000