Skip to content

Commit 680904e

Browse files
authored
Merge pull request #92 from FacundoInza/develop
v1.0.0 First Launch
2 parents d27adb4 + f280ba1 commit 680904e

File tree

138 files changed

+16868
-2543
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+16868
-2543
lines changed

.eslintrc.json

+59-55
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,63 @@
11
{
2-
"parser": "@babel/eslint-parser",
3-
"settings": {
4-
"react": {
5-
"version": "detect"
6-
}
7-
},
8-
"env": {
9-
"browser": true,
10-
"es2021": true,
11-
"node": true,
12-
"commonjs": true,
13-
"cypress/globals": true
14-
},
15-
"extends": [
16-
"eslint:recommended",
17-
"plugin:react/recommended",
18-
"plugin:react-hooks/recommended"
19-
],
20-
"parserOptions": {
21-
"ecmaFeatures": {
22-
"jsx": true
2+
"parser": "@babel/eslint-parser",
3+
"settings": {
4+
"react": {
5+
"version": "detect"
6+
}
237
},
24-
"ecmaVersion": 12,
25-
"sourceType": "module",
26-
"requireConfigFile": false
27-
},
28-
"plugins": ["react", "cypress"],
29-
"rules": {
30-
"indent": ["warn", "tab"],
31-
"linebreak-style": ["warn", "unix"],
32-
"quotes": ["warn", "single"],
33-
"semi": ["warn", "never"],
34-
"react/prop-types": "off",
35-
"react/display-name": "off",
36-
"react-hooks/exhaustive-deps": "off",
37-
"react-hooks/rules-of-hooks": "error"
38-
},
39-
"overrides": [
40-
{
41-
"files": ["**/*.ts", "**/*.tsx"],
42-
"parser": "@typescript-eslint/parser",
43-
"plugins": ["@typescript-eslint"],
44-
"extends": [
8+
"env": {
9+
"browser": true,
10+
"es2021": true,
11+
"node": true,
12+
"commonjs": true,
13+
"cypress/globals": true
14+
},
15+
"extends": [
4516
"eslint:recommended",
46-
"plugin:@typescript-eslint/recommended"
47-
],
48-
"rules": {
49-
"indent": ["off", "tab"],
50-
"@typescript-eslint/indent": ["error", "tab"],
51-
"@typescript-eslint/quotes": ["error", "single"],
52-
"@typescript-eslint/no-unused-vars": "error",
53-
"@typescript-eslint/no-explicit-any": "off",
54-
"jsdoc/require-param-type": "off",
55-
"jsdoc/require-returns-type": "off"
56-
}
57-
}
58-
]
17+
"plugin:react/recommended",
18+
"plugin:react-hooks/recommended",
19+
"plugin:prettier/recommended"
20+
],
21+
"parserOptions": {
22+
"ecmaFeatures": {
23+
"jsx": true
24+
},
25+
"ecmaVersion": 12,
26+
"sourceType": "module",
27+
"requireConfigFile": false
28+
},
29+
"plugins": ["react", "cypress", "prettier"],
30+
"rules": {
31+
"indent": ["warn", "tab"],
32+
"linebreak-style": ["warn", "unix"],
33+
"quotes": ["warn", "single"],
34+
"semi": ["warn", "never"],
35+
"react/prop-types": "off",
36+
"react/display-name": "off",
37+
"react-hooks/exhaustive-deps": "off",
38+
"react-hooks/rules-of-hooks": "error",
39+
"prettier/prettier": "warn"
40+
},
41+
"overrides": [
42+
{
43+
"files": ["**/*.ts", "**/*.tsx"],
44+
"parser": "@typescript-eslint/parser",
45+
"plugins": ["@typescript-eslint"],
46+
"extends": [
47+
"eslint:recommended",
48+
"plugin:@typescript-eslint/recommended",
49+
"plugin:prettier/recommended"
50+
],
51+
"rules": {
52+
"indent": ["warn", 4],
53+
"@typescript-eslint/indent": ["warn", 4],
54+
"@typescript-eslint/quotes": ["error", "single"],
55+
"@typescript-eslint/no-unused-vars": "error",
56+
"@typescript-eslint/no-explicit-any": "off",
57+
"jsdoc/require-param-type": "off",
58+
"jsdoc/require-returns-type": "off",
59+
"prettier/prettier": "warn"
60+
}
61+
}
62+
]
5963
}

.github/workflows/deployment.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy to production
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
deploy:
9+
name: Build image
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out code
14+
uses: actions/checkout@v2
15+
16+
- name: Install kubectl
17+
uses: azure/setup-kubectl@v1
18+
with:
19+
version: 'v1.1.1'
20+
id: install
21+
22+
- name: Configure AWS credentials
23+
uses: aws-actions/configure-aws-credentials@v1
24+
with:
25+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
26+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
27+
aws-region: sa-east-1
28+
29+
- name: Login to Amazon ECR
30+
id: login-ecr
31+
uses: aws-actions/amazon-ecr-login@v1
32+
33+
- name: Load secrets and save to app.env
34+
run: aws secretsmanager get-secret-value --secret-id prod/deliverit-front --query SecretString --output text | jq -r 'to_entries|map("\(.key)=\(.value)")|.[]' > .env
35+
36+
- name: Build, tag, and push image to Amazon ECR
37+
env:
38+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
39+
ECR_REPOSITORY: deliverit-front-dealer
40+
IMAGE_TAG: ${{ github.sha }}
41+
run: |
42+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
43+
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
44+
45+
- name: Update kube config
46+
run: aws eks update-kubeconfig --name deliverit-cluster --region sa-east-1
47+
48+
- name: Deploy image to Amazon EKS
49+
run: |
50+
kubectl apply -f eks/aws-auth.yaml
51+
kubectl delete deployments deliverit-front-dealer-deployment
52+
kubectl apply -f eks/deployment.yaml
53+
kubectl apply -f eks/service.yaml

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files
22

33
# dependencies
44
/node_modules
@@ -33,3 +33,5 @@ yarn-error.log*
3333
# typescript
3434
*.tsbuildinfo
3535
next-env.d.ts
36+
37+
.env

.husky/pre-commit

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged
5+
npm run build

.lintstagedrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"**/*.{js,jsx,ts,tsx}": ["eslint --fix", "git add"]
3+
}

.prettierrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 4,
4+
"semi": true,
5+
"singleQuote": true,
6+
"jsxSingleQuote": true,
7+
"printWidth": 80
8+
}

.vscode/extensions.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"vscode-icons-team.vscode-icons"
4+
]
5+
}

Dockerfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Stage 1: Build the Next.js app
2+
FROM node:18 AS builder
3+
4+
# Set the working directory inside the container
5+
WORKDIR /app
6+
7+
# Copy the package.json and package-lock.json to the container
8+
COPY package*.json ./
9+
10+
# Install dependencies
11+
RUN npm install
12+
13+
# Copy the rest of the app source code to the container
14+
COPY . .
15+
16+
# Build the Next.js app
17+
RUN npm run build
18+
19+
# Stage 2: Serve the app using a lightweight production image
20+
FROM node:18-alpine
21+
22+
# Set the working directory inside the container
23+
WORKDIR /app
24+
25+
# Copy the built app from the previous stage
26+
COPY --from=builder /app/.next ./.next
27+
COPY --from=builder /app/node_modules ./node_modules
28+
COPY --from=builder /app/package.json ./package.json
29+
30+
# Expose the port on which your Next.js app will run (change this to your app's port)
31+
EXPOSE 3000
32+
33+
# Start the Next.js app in production mode
34+
CMD ["npm", "start"]

0 commit comments

Comments
 (0)