Skip to content

Commit 69421be

Browse files
authored
Merge pull request #6 from JalilaMuadi/addtests-v2
feat: setup docker and cd workflow
2 parents bc6db31 + 5478dea commit 69421be

File tree

4 files changed

+44
-17
lines changed

4 files changed

+44
-17
lines changed

.github/workflows/cd.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,19 @@ jobs:
2121
- name: Install dependencies
2222
run: npm ci
2323

24-
- name: Build the app
25-
run: npm run build
24+
- name: Build app
25+
run: npm run build
26+
27+
- id: auth
28+
uses: google-github-actions/auth@v2
29+
with:
30+
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
31+
32+
- name: Set up Cloud SDK
33+
uses: google-github-actions/setup-gcloud@v2
34+
35+
- name: Use gcloud CLI
36+
run: gcloud info
37+
38+
- name: Build and push Docker image
39+
run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-491114/notely-ar-repo/notely:latest .

.github/workflows/ci.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ jobs:
1818
with:
1919
node-version: 22
2020

21-
- name: ÷Install dependencies
21+
- name: Install dependencies
2222
run: npm ci
2323

24-
- name: Run Tests
24+
- name: Run unit tests
2525
run: npm run test -- --coverage
26+
2627
style:
2728
name: Style
2829
runs-on: ubuntu-latest
30+
2931
steps:
3032
- name: Check out code
3133
uses: actions/checkout@v4
@@ -38,9 +40,8 @@ jobs:
3840
- name: Install dependencies
3941
run: npm ci
4042

41-
- name: Check Formatting
43+
- name: Check formatting
4244
run: npm run format:check
4345

44-
- name: check linting
45-
run: npm run lint -- --max-warnings=0
46-
46+
- name: Check linting
47+
run: npm run lint -- --max-warnings=0

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
*.tar.gz
2+
google-cloud-sdk/
3+
Installation directory*/
4+
venv/
5+
.venv/
16
node_modules/
2-
coverage/
37
dist/
48
.env
5-
.DS_Store
6-
.idea/
7-
.vscode/
8-
*.log

Dockerfile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1-
FROM --platform=linux/amd64 node:22-slim
1+
# Base image
2+
FROM node:22-alpine
23

3-
WORKDIR /usr/src/app
4+
# Set working directory
5+
WORKDIR /app
46

5-
ADD . .
7+
# Copy package files
8+
COPY package*.json ./
69

10+
# Install dependencies
711
RUN npm ci
812

13+
# Copy source code
14+
COPY . .
15+
16+
# Build app
917
RUN npm run build
1018

11-
CMD ["node", "dist/main.js"]
19+
# Expose port
20+
EXPOSE 8080
21+
22+
# Start server
23+
CMD ["npm", "run", "dev"]

0 commit comments

Comments
 (0)