Skip to content

Commit 9220647

Browse files
committed
Add frontend Dockerfile and Docker-based CI workflow
1 parent 99f40fc commit 9220647

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Frontend Docker CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
frontend-docker:
11+
name: Frontend Docker Build & Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: Build Docker image
20+
run: docker build -t smartquery-frontend ./frontend
21+
22+
- name: Run lint in Docker
23+
run: docker run --rm smartquery-frontend npm run lint
24+
25+
- name: Run tests in Docker
26+
run: docker run --rm smartquery-frontend npm run test
27+
28+
- name: Run build in Docker
29+
run: docker run --rm smartquery-frontend npm run build

frontend/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Use a specific Node version for consistency
2+
FROM node:18.20.2-alpine
3+
4+
WORKDIR /app
5+
6+
# Install dependencies
7+
COPY package.json package-lock.json ./
8+
RUN npm ci
9+
10+
# Copy the rest of the code
11+
COPY . .
12+
13+
# Run lint, test, and build as part of the image build
14+
RUN npm run lint && npm run test && npm run build
15+
16+
EXPOSE 3000
17+
CMD ["npm", "start"]

0 commit comments

Comments
 (0)