Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #98 from gekko-org/backend_fix
Browse files Browse the repository at this point in the history
Backend fix
  • Loading branch information
kanade9 committed Mar 14, 2020
2 parents 769581c + 72ccc2c commit 7ace2ee
Show file tree
Hide file tree
Showing 25 changed files with 3,541 additions and 424 deletions.
3 changes: 3 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
functions/node_modules
docker-mount
functions/lib
4 changes: 4 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
node_modules
functions/node_modules
docker-mount
auths
.idea
pj-marowd-key.json
20 changes: 20 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:10-alpine

WORKDIR /app

# install Firebase CLI Tools
RUN npm install -g firebase-tools eslint
ADD config.json /root/.config/configstore/@google-cloud/functions-emulator/config.json
COPY . .
RUN cd functions && \
npm install
# settings for runtime emulator
ENV HOST 0.0.0.0
ENV GOOGLE_APPLICATION_CREDENTIALS "/app/pj-marowd-key.json"
EXPOSE 5000

# settings for Firebase login
EXPOSE 9005

# i can deploy with firebase deploy --token $TOKEN
# firebase serve -o 0.0.0.0
14 changes: 14 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@ Pj-marowd Cloud Functions
# Linting
1. ` cd backend/functions `
1. ` yarn run lint `

# Dockerを使ったローカル動作確認手順
## (一回で良い)ci用トークンの取得
- `docker build -t runner . && docker run runner /bin/sh` でコンテナを作ってその中に入る
- コンテナ内で`firebase login:ci --no-localhost` でログインするとtokenが取得できるのでメモる。

## ローカルにCloud Functionsを立てて動作確認(localhost:5000)
- 先ほど作成したci用トークンを取得して`docker build -t runner . && docker run --env TOKEN=<token> runner /bin/sh`
- `cd functions`
- `npm run serve`で動作します。

## デプロイ
- 先ほど作成したci用トークンを取得して`docker build -t runner . && docker run --env TOKEN=<token> runner /bin/sh`
- `firebase deploy --token $TOKEN`で動作します。
3 changes: 3 additions & 0 deletions backend/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"bindHost": "0.0.0.0"
}
22 changes: 22 additions & 0 deletions backend/functions/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
],
"plugins": [
"@typescript-eslint"
],
"env": { "node": true, "es6": true },
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
// for @kanade9 DBに渡るときスネークケースなので強制キャメルケース制約をOFFにしました。
"@typescript-eslint/camelcase": ["error", { "properties": "never" } ]
}
}
Loading

0 comments on commit 7ace2ee

Please sign in to comment.