Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
Contains receipts service's project base already dockerided
  • Loading branch information
bernardohrl committed Sep 14, 2018
0 parents commit ca8353c
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
env
.dockerignore
Dockerfile-dev
Dockerfile-prod
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__pycache__
env
.vscode/
15 changes: 15 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Base Image
FROM python:3.6.5-alpine

# Setting working directory
WORKDIR /usr/src/app

# Dealing with requirements
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt

# Coping project
COPY . /usr/src/app

# Running server
CMD python manage.py run -h 0.0.0.0
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Configurando o ambiente
Para instruções de como instalar o Docker e o Docker-compose clique [aqui](https://github.com/Kalkuli/2018.2-Kalkuli_Front-End/blob/master/README.md).


<br>

## Colocando no ar
Com o Docker e Docker-Compose instalados, basta apenas utilizar os comandos:

```docker-compose -f docker-compose-dev.yml build```

e

```docker-compose -f docker-compose-dev.yml up```

Acesse o servidor local no endereço apresentado abaixo:

http://localhost:5006/


Agora você já pode começar a contribuir!
14 changes: 14 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.6'
services:
users:
build:
context: .
dockerfile: Dockerfile-dev
volumes:
- '.:/usr/src/app'
ports:
- 5006:5000
environment:
- FLASK_APP=project/__init__.py
- FLASK_ENV=development
- APP_SETTINGS=project.config.DevelopmentConfig
7 changes: 7 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from flask.cli import FlaskGroup
from project import app

cli = FlaskGroup(app)

if __name__ == '__main__':
cli()
15 changes: 15 additions & 0 deletions project/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
from flask import Flask, jsonify

# Instantiate the app
app = Flask(__name__)

# Set Configuration
app_settings = os.getenv('APP_SETTINGS')
app.config.from_object(app_settings)

@app.route('/', methods=['GET'])
def ping_pong():
return jsonify({
'data': 'Welcome to Kalkuli Receipts Service'
})
Empty file added project/api/__init__.py
Empty file.
15 changes: 15 additions & 0 deletions project/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class BaseConfig:
"""Base configuration"""
TESTING = False

class DevelopmentConfig(BaseConfig):
"""Development configuration"""
pass

class TestingConfig(BaseConfig):
"""Testing configuration"""
TESTING = True

class ProductionConfig(BaseConfig):
"""Production configuration"""
pass
Empty file added project/tests/__init__.py
Empty file.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flask==1.0.2

0 comments on commit ca8353c

Please sign in to comment.