Skip to content

Commit

Permalink
Merge pull request #3 from MiqSA/1-setup-application
Browse files Browse the repository at this point in the history
Add initial setup
  • Loading branch information
MiqSA authored Feb 20, 2023
2 parents da2ec15 + fc5c01a commit 99f99a3
Show file tree
Hide file tree
Showing 15 changed files with 562 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM python:3.10
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /usr/app
COPY requirements.txt .
RUN pip install -r requirements.txt
CMD ["python", "server.py"]
Empty file added app/__init__.py
Empty file.
Empty file added app/api/__init__.py
Empty file.
Empty file added app/api/errors.py
Empty file.
Empty file added app/api/views.py
Empty file.
Empty file added app/exceptions.py
Empty file.
Empty file added app/main/__init__.py
Empty file.
Empty file added app/main/errors.py
Empty file.
Empty file added app/main/views.py
Empty file.
Empty file added app/models.py
Empty file.
1 change: 1 addition & 0 deletions app/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flask
9 changes: 9 additions & 0 deletions app/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from flask import Flask
server = Flask(__name__)

@server.route("/")
def hello():
return { "hello": "world!" }

if __name__ == "__main__":
server.run(host='0.0.0.0', port='8000')
6 changes: 6 additions & 0 deletions database/initdb.d/setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE data (
id int(11) not null primary key auto_increment,
url varchar(255) not null,
title varchar(100) not null,
date_added datetime not null
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
34 changes: 34 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: "3.9"

services:
app:
build:
context: "./app"
env_file: .env
volumes:
- ./app/:/usr/app/
depends_on:
- database
ports:
- "8082:8000"
networks:
- production-network
expose:
- 8000
database:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: v25xhycLlRY3sV7Z
MYSQL_DATABASE: "exercise"
volumes:
- ./database/initdb.d:/docker-entrypoint-initdb.d
networks:
- production-network
ports:
- "3306:3306"
expose:
- 3306
networks:
production-network:
driver: bridge
Loading

0 comments on commit 99f99a3

Please sign in to comment.