Skip to content

Commit dd928dc

Browse files
committed
Merge branch '#156-move-rooms-to-the-past-room-list-and-change-settlestatus-automatically-when-the-participant-is-one' of https://github.com/sparcs-kaist/taxi-back into #156-move-rooms-to-the-past-room-list-and-change-settlestatus-automatically-when-the-participant-is-one
2 parents a231e2d + 739cdcc commit dd928dc

25 files changed

+781
-38
lines changed

.dockerignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/node_modules
2+
.env.test
3+
.env.production
4+
.env.development
5+
.DS_store
6+
*.code-workspace
7+
*.swp
8+
/logs/*.log
9+
10+
# AdminJS 관련 디렉토리
11+
.adminjs

.env.example

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ FRONT_URL=[front url(e.g. http://localhost:3000)]
88
AWS_ACCESS_KEY_ID=[AWS Access key ID]
99
AWS_SECRET_ACCESS_KEY=[AWS Secret access key]
1010
AWS_S3_BUCKET_NAME=[AWS S3 Buck name]
11+
JWT_SECRET_KEY=[JWT SERCRET KEY]
12+
APP_URI_SCHEME=[APP_URI_SCHEME]
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Create Release and Tag
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
branches:
7+
- main
8+
9+
jobs:
10+
if_merged:
11+
if: github.event.pull_request.merged == true
12+
name: Create Release and Tag
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Get previous tag-version
22+
id: previous_tag
23+
uses: WyriHaximus/github-action-get-previous-tag@v1
24+
with:
25+
fallback: 1.0.0
26+
27+
- name: Get next minor tag-version
28+
id: minor_tag
29+
uses: WyriHaximus/github-action-next-semvers@v1
30+
with:
31+
version: ${{ steps.previous_tag.outputs.tag }}
32+
33+
- name: Get current time
34+
uses: josStorer/[email protected]
35+
id: date
36+
with:
37+
format: YYYY-MM-DD
38+
utcOffset: "+09:00"
39+
40+
- name: Create Release
41+
id: create_release
42+
uses: actions/create-release@v1
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
with:
46+
tag_name: ${{ steps.minor_tag.outputs.v_patch }}
47+
release_name: ${{ steps.minor_tag.outputs.v_patch }}
48+
body: |
49+
${{ steps.date.outputs.formattedTime }}
50+
Github action released ${{ steps.minor_tag.outputs.v_patch }}
51+
draft: false
52+
prerelease: false

.github/workflows/push_image_ecr.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Push Prod Image to Amazon ECR
2+
3+
# when tagging action success
4+
on:
5+
workflow_run:
6+
workflows: ["Create Release and Tag"]
7+
types:
8+
- completed
9+
10+
env:
11+
AWS_REGION: ap-northeast-2
12+
13+
jobs:
14+
if_workflow_success:
15+
name: Build and Push
16+
runs-on: ubuntu-latest
17+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Get previous tag-version
26+
id: previous_tag
27+
uses: WyriHaximus/github-action-get-previous-tag@v1
28+
with:
29+
fallback: 1.0.0
30+
31+
- name: Set Tag Version
32+
id: tag
33+
uses: actions/github-script@v4
34+
with:
35+
script: |
36+
const tagVersion = "${{ steps.previous_tag.outputs.tag }}".replace('v', '')
37+
core.setOutput('tag', tagVersion)
38+
39+
- name: Configure AWS credentials
40+
uses: aws-actions/configure-aws-credentials@v1
41+
with:
42+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
43+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
44+
aws-region: ${{ env.AWS_REGION }}
45+
46+
- name: Login to AWS ECR
47+
id: login-ecr
48+
uses: aws-actions/amazon-ecr-login@v1
49+
50+
- name: Build and Push to AWS ECR
51+
id: build_image
52+
env:
53+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
54+
IMAGE_TAG: ${{ steps.tag.outputs.tag }}
55+
ECR_REPOSITORY: taxi-back
56+
run: |
57+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
58+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
59+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
60+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
61+
echo "Push iamge : $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG and latest"
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Push Dev Image to Amazon ECR
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
branches:
7+
- dev
8+
9+
env:
10+
AWS_REGION: ap-northeast-2
11+
12+
jobs:
13+
if_merged:
14+
if: github.event.pull_request.merged == true
15+
name: Create Release and Tag
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Configure AWS credentials
25+
uses: aws-actions/configure-aws-credentials@v1
26+
with:
27+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
28+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
29+
aws-region: ${{ env.AWS_REGION }}
30+
31+
- name: Login to AWS ECR
32+
id: login-ecr
33+
uses: aws-actions/amazon-ecr-login@v1
34+
35+
- name: Build and Push to AWS ECR
36+
id: build_image
37+
env:
38+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
39+
ECR_REPOSITORY: taxi-back
40+
run: |
41+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:dev .
42+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:dev
43+
echo "Push iamge : $ECR_REGISTRY/$ECR_REPOSITORY:dev"

.github/workflows/node.js.yml .github/workflows/test_ci.yml

+6-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
name: Node.js CI
3+
name: Test for Continuous integration
44
on:
55
push:
66
branches: [ "main" ]
@@ -19,34 +19,16 @@ jobs:
1919
run: sudo docker run --name mongodb -d -p 27017:27017 mongo:${{ matrix.mongodb-version }}
2020
- name: Use Node.js ${{ matrix.node-version }}
2121
uses: actions/checkout@v3
22+
with:
23+
submodules: true
2224
- name: Setup Node
2325
uses: actions/setup-node@v3
2426
with:
2527
node-version: ${{ matrix.node-version }}
2628
cache: 'npm'
27-
- name: Install aws cli
28-
run: sudo apt update && sudo apt install awscli
29-
- name: create AWS configuration file and copy
30-
run: |
31-
mkdir -p ~/.aws
32-
cd ~/.aws
33-
pwd
34-
touch credentials
35-
echo "[default]" >> credentials
36-
echo aws_access_key_id = ${{ secrets.AWS_ACCESS_KEY_ID }} >> credentials
37-
echo aws_secret_access_key = ${{ secrets.AWS_SECRET_ACCESS_KEY }} >> credentials
38-
cat credentials
39-
touch config
40-
echo "[default]" >> config
41-
echo "region = ap-northeast-2" >> config
42-
echo "output = json" >> config
43-
- name: Download mongoDB dump file
44-
run: aws s3 cp --recursive s3://${{ secrets.AWS_S3_BUCKET_NAME }}/dump dump
45-
- name: Copy to mongodb container
46-
run: docker cp dump mongodb:/dump
47-
- name: Restore DB from dump file
48-
run: docker exec mongodb sh -c 'mongorestore ${{ secrets.DB_PATH }} /dump/${{ secrets.DB_NAME }}'
49-
- name: Install dependencies from package-lock.json
29+
- name: Install sampleGenerator dependencies from package-lock.json
30+
run: cd sampleGenerator && npm ci && cd ..
31+
- name: Install taxi-back dependencies from package-lock.json
5032
run: npm ci
5133
- name: Run unit tests
5234
run: npm test

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "sampleGenerator"]
2+
path = sampleGenerator
3+
url = https://github.com/sparcs-kaist/taxiSampleGenerator

Dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM node:16-alpine
2+
3+
# Copy repository
4+
WORKDIR /usr/src/app
5+
COPY . .
6+
7+
# Install curl (for taxi-docker)
8+
RUN apk update && apk add curl
9+
10+
# Install requirements
11+
RUN npm ci
12+
13+
# Run container
14+
EXPOSE 80
15+
ENV PORT 80
16+
CMD ["npm", "run", "serve"]

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ See [contributors](https://github.com/sparcs-kaist/taxi-front/graphs/contributor
4444
- frontend : https://github.com/sparcs-kaist/taxi-front
4545
- backend : https://github.com/sparcs-kaist/taxi-back
4646
- app : https://github.com/sparcs-kaist/taxi-app
47+
- docker : https://github.com/sparcs-kaist/taxi-docker
4748
- figma : https://www.figma.com/file/li34hP1oStJAzLNjcG5KjN/SPARCS-Taxi?node-id=0%3A1
4849
- taxiSampleGenerator : https://github.com/sparcs-kaist/taxiSampleGenerator

0 commit comments

Comments
 (0)