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

#20: Adding Docker-Compose Baseline #21

Open
wants to merge 4 commits into
base: master
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
8 changes: 8 additions & 0 deletions ChadevMonsterUI/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM nginx:latest
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt install -y nodejs
RUN npm install
CMD npm run serve
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.8-buster
WORKDIR /usr/src/app
COPY . /usr/src/app
ENV ENVIRONMENT=dev
RUN pip install -r requirements/base.txt
RUN mv config/example-dev.py /usr/src/app/config/dev.py
RUN ls -l /usr/src/app/config/
CMD python run.py
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,10 @@ Run the `build` command in Vue UI

Files for deployment will be in the `dist` folder.

## Docker Setup

Run the following command in the root of the directory:

```
docker-compose up --build
```
1 change: 1 addition & 0 deletions chadevmonster/templates/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><h1>404</h1></html>
1 change: 1 addition & 0 deletions chadevmonster/templates/405.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><h1>405</h1></html>
1 change: 1 addition & 0 deletions chadevmonster/templates/500.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><h1>500</h1></html>
4 changes: 2 additions & 2 deletions config/example-dev.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-

APP_SECRET_KEY = "some secret key"
DATABASE_URI = "postgresql:///chadevmonster?client_encoding=utf8"
DATABASE_URI = "postgresql://postgres:postgres@postgres/chadevmonster"
PORT = 5000
DEBUG = True
# running in dev environment, use gmail account below
MAIL_USERNAME = "[email protected]"
MAIL_PASSWORD = "password"
MAIL_SERVER = "smtp.host.org"
MAIL_PORT = 587
MAIL_DEFAULT_SENDER = "SiteName <[email protected]>"
MAIL_DEFAULT_SENDER = "SiteName <[email protected]>"
43 changes: 43 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: '3.7'
services:
postgres:
image: postgres:12.1-alpine
expose:
- 5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
server:
build:
context: ./
dockerfile: Dockerfile
ports:
- 5000:5000
environment:
- FLASK_ENV=development
- APP_SETTINGS=project.config.DevelopmentConfig
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- ENVIRONMENT=dev
depends_on:
- postgres
migration:
image: chadevmonster_server
# Ping added so we wait for the DB to be online
command: >
sh -c "ping -c 10 postgres &&
python manage.py create_db &&
python manage.py db upgrade"
depends_on:
- server
- postgres
vue:
build:
context: ./ChadevMonsterUI/
dockerfile: Dockerfile
ports:
- 8080:8080
depends_on:
- migration
- postgres
- server