Skip to content

Commit

Permalink
Merge pull request #55 from mia-ajuda/develop
Browse files Browse the repository at this point in the history
update master
  • Loading branch information
darmsDD authored May 30, 2020
2 parents 253d523 + 990e644 commit f655f7f
Show file tree
Hide file tree
Showing 51 changed files with 7,616 additions and 1,079 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 2 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_URL=
NODE_ENV=[development|production]
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"airbnb-base"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"indent": ["error", 4],
"no-underscore-dangle": 0,
"no-param-reassign": 0,
"max-len": ["error", { "code": 120 }],
"no-useless-catch": 0,
"class-methods-use-this": 0
}
}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ build/Release
node_modules/
jspm_packages/

# Firebase config
src/config/firebaseConfig.js

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

Expand Down Expand Up @@ -106,9 +109,13 @@ dist

# Stores VSCode versions used for testing VSCode extensions
.vscode-test
.vscode

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.pnp.*

# package-lock (main is yarn.lock)
package-lock.json
52 changes: 52 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
stages:
- lint
- build

lint:
stage: lint
image: node:12.2.0-alpine
before_script:
- npm install
script:
- npx eslint ./src
allow_failure: true

build:
services:
- docker:dind
image: docker:stable
stage: build
variables:
IMAGE_NAME: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
before_script:
- cat $FIREBASE_CONFIG > ./src/config/fibaseConfig.js
script:
- echo "Building image"
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . -t $IMAGE_NAME
- docker push $IMAGE_NAME
- docker tag $IMAGE_NAME $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
except:
- master
- configuracao-ci

build stable:
services:
- docker:dind
image: docker:stable
stage: build
variables:
IMAGE_NAME: "$CI_REGISTRY_IMAGE:stable"
before_script:
- cat $FIREBASE_CONFIG > ./src/config/fibaseConfig.js
script:
- echo "Building image"
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . -t $IMAGE_NAME
- docker push $IMAGE_NAME
only:
- master
- configuracao-ci


17 changes: 0 additions & 17 deletions .vscode/launch.json

This file was deleted.

11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM node:12.2.0-alpine

# Define o diretório de trabalho como /app
WORKDIR /app

COPY package*.json ./

# Copia os arquivos locais para o container
COPY ./ ./
# Instala as dependências do projeto
RUN yarn install

COPY ./ ./
COPY ./ ./

CMD ["yarn", "start"]
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Mia Ajuda - Backend

<a href="https://2019-2-arquitetura-desenho.github.io/wiki/" target="_blank"><img src="https://img.shields.io/badge/Mia%20Ajuda-2020.1-purple"></a>

Projeto criado e desenvolvido por professores e estudantes da Faculdade do Gama (FGA), da Universidade de Brasília, com o intuito de contribuir com a sociedade em um momento de necessidade que estamos vivendo em relação à CoVid-19. O aplicativo tem o propósito de ser uma ferramenta de incentivo a ações sociais de ajuda e colaboração entre pessoas de comunidades e vizinhanças. O Mia Ajuda serve como um meio de ligação entre pessoas necessitadas e voluntários que possam ajudar, seja de forma imaterial (entretenimento, companhia, amparo psicológico), como de forma material (comida, objetos, itens de higiene pessoal).
<a href="https://mia-ajuda.github.io/Documentation/#/" target="_blank"><img src="https://img.shields.io/badge/Mia%20Ajuda-2020.1-purple"></a>

## Rode com Docker

Para executar localmente a aplicação, proceda com os seguintes passos:

1. Instale o Docker [neste link](https://docs.docker.com/install/linux/docker-ce/ubuntu/).
2. Instale o Docker Compose [neste link](https://docs.docker.com/compose/install/).
3. Na pasta principal do projeto, construa e inicialize a aplicação com o comando: `sudo docker-compose -f docker-compose.yml up --build`.
4. O backend estará disponível em: `http://localhost:8000/`.
3. Pegue o arquivo firebaseConfig.js do drive na pasta firebase e coloque-o dentro da pasta config do projeto.
4. Crie um arquivo .env e dentro dele crie 2 váriaveis de ambiente LATITUDE_ENV= e LONGITUDE_ENV=
5. Coloque a latitude e longitude de sua casa nas variáveis de ambiente.
6. Na pasta principal do projeto, construa e inicialize a aplicação com o comando: `sudo docker-compose -f docker-compose.yml up --build`.
7. O backend estará disponível em: `http://localhost:8000/`.

* Observação: por padrão, o docker-compose iniciará a API com `yarn start`.
* Observação: por padrão, o docker-compose iniciará a API com `yarn start`.
11 changes: 7 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ version: '3'
services:
backend:
container_name: backend
environment:
- DATABASE_URL=mongodb://mongo/miaAjudaDB
build:
context: .
dockerfile: Dockerfile
command: "yarn start"
ports:
- "8000:8000"
depends_on:
depends_on:
- mongo
volumes:
- .:/app
- /app/node_modules
mongo:
container_name: mongo
image: mongo

image: mongo
Loading

0 comments on commit f655f7f

Please sign in to comment.