Skip to content

Commit f5f9c95

Browse files
committed
first commit
Signed-off-by: unosega@gmail.com <unosega@gmail.com>
0 parents  commit f5f9c95

Some content is hidden

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

55 files changed

+9256
-0
lines changed

.github/workflows/cicd.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI/CD Pipeline RestAPI Users
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- "README.md"
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
continuous-integration:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout Code
19+
uses: actions/checkout@v4
20+
21+
- name: Login to Docker Hub
22+
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
23+
24+
- name: Build Docker Image
25+
run: docker build -t juwono136/restapi-users .
26+
27+
- name: Publish Image to Docker Hub
28+
run: docker push juwono136/restapi-users:latest
29+
30+
continuous-deployment:
31+
needs: continuous-integration
32+
runs-on: self-hosted
33+
steps:
34+
- name: Pull image from docker hub
35+
run: docker pull juwono136/restapi-users:latest
36+
37+
- name: Stop and Delete Old Container
38+
run: |
39+
docker stop restapi-users-container || true
40+
docker rm restapi-users-container || true
41+
42+
- name: Run Docker Container
43+
run: |
44+
docker run -d \
45+
-p 5000:5000 \
46+
--name restapi-users-container \
47+
--restart always \
48+
-e PORT=${{ secrets.PORT }} \
49+
-e CONNECTION_URL='${{ secrets.CONNECTION_URL }}' \
50+
-e DB_NAME='${{ secrets.DB_NAME }}' \
51+
-e DEFAULT_CLIENT_URL='${{ secrets.DEFAULT_CLIENT_URL }}' \
52+
-e INTERNET_SERVER='${{ secrets.INTERNET_SERVER }}' \
53+
-e NODE_ENV='${{ secrets.NODE_ENV }}' \
54+
-e REFRESH_TOKEN_SECRET='${{ secrets.REFRESH_TOKEN_SECRET }}' \
55+
-e ACCESS_TOKEN_SECRET='${{ secrets.ACCESS_TOKEN_SECRET }}' \
56+
-e ACTIVATION_TOKEN_SECRET='${{ secrets.ACTIVATION_TOKEN_SECRET }}' \
57+
-e EMAIL_USER='${{ secrets.EMAIL_USER }}' \
58+
-e EMAIL_PASSWORD='${{ secrets.EMAIL_PASSWORD }}' \
59+
juwono136/restapi-users
60+
61+
- name: Add Container to Tunnel
62+
run: docker network connect ${{secrets.TUNNEL_NAME}} restapi-users-container

.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.env
6+
/.pnp
7+
.pnp.js
8+
9+
# testing
10+
/coverage
11+
12+
# production
13+
/build
14+
15+
# misc
16+
.DS_Store
17+
.env.local
18+
.env.development.local
19+
.env.test.local
20+
.env.production.local
21+
22+
npm-debug.log*
23+
yarn-debug.log*
24+
yarn-error.log*
25+
26+
# Logs
27+
client/logs
28+
*.log
29+
npm-debug.log*
30+
yarn-debug.log*
31+
yarn-error.log*
32+
pnpm-debug.log*
33+
lerna-debug.log*
34+
35+
dist
36+
dist-ssr
37+
*.local
38+
39+
# Editor directories and files
40+
.vscode/*
41+
!.vscode/extensions.json
42+
.idea
43+
.DS_Store
44+
*.suo
45+
*.ntvs*
46+
*.njsproj
47+
*.sln
48+
*.sw?

CONTRIBUTING.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributing Guide
2+
3+
Thanks for considering contributing to this project! 🚀
4+
There are many ways you can help:
5+
6+
## 🐛 Reporting Issues
7+
8+
- Check the [issue tracker](../../issues) to see if your bug or feature request already exists.
9+
- If not, create a new issue:
10+
- Use a clear, descriptive title.
11+
- Provide as much detail as possible (steps to reproduce, screenshots, expected vs. actual behavior).
12+
13+
## 💡 Suggesting Features
14+
15+
- Open an issue with the label `enhancement`.
16+
- Describe the problem your feature would solve.
17+
- Suggest a possible solution or approach if you have one.
18+
19+
## 🔧 Contributing Code
20+
21+
1. Fork this repository.
22+
2. Create a new branch: `git checkout -b feature/your-feature-name`
23+
3. Make your changes and commit: `git commit -m "Add your message here"`
24+
4. Push to your fork: `git push origin feature/your-feature-name`
25+
5. Submit a pull request.
26+
27+
## ✅ Pull Request Guidelines
28+
29+
- Keep PRs small and focused.
30+
- Reference related issues (`Closes #issue_number`).
31+
- Ensure code follows the project’s style and conventions.
32+
- Add tests if applicable.
33+
34+
We welcome all contributions — from fixing typos to major features!

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# --- Build Stage ---
2+
FROM node:alpine3.20 AS builder
3+
4+
WORKDIR /app
5+
6+
# Copy package files and install all dependencies
7+
COPY package*.json ./
8+
RUN npm install
9+
10+
COPY . .
11+
12+
13+
# --- Production Stage ---
14+
FROM node:alpine3.20
15+
16+
WORKDIR /app
17+
18+
# Only install production dependencies for a smaller, safer image
19+
COPY package*.json ./
20+
RUN npm install --only=production
21+
22+
# Copy the app from the 'builder' stage
23+
COPY --from=builder /app .
24+
25+
# Expose the port
26+
EXPOSE 5000
27+
28+
# run the app
29+
CMD ["node", "index.js"]

0 commit comments

Comments
 (0)