Skip to content

Commit a916ca5

Browse files
Merge branch 'dev' into man/backend-matching-service-setup
2 parents 10d7887 + 9631281 commit a916ca5

31 files changed

+2679
-5
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI (backend - execution service)
2+
3+
on:
4+
pull_request:
5+
branches: [dev, staging]
6+
paths:
7+
- "backend/execution-service/**"
8+
- "pnpm-lock.yaml"
9+
- "package.json"
10+
- ".github/workflows/ci-execution-service.yml"
11+
push:
12+
branches: [dev, staging]
13+
paths:
14+
- "backend/execution-service/**"
15+
- "pnpm-lock.yaml"
16+
- "package.json"
17+
- ".github/workflows/ci-execution-service.yml"
18+
19+
concurrency:
20+
group: ci-${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
build-test:
25+
name: Build
26+
runs-on: ubuntu-latest
27+
env:
28+
CI: true
29+
services:
30+
mongodb:
31+
image: mongo:8
32+
ports:
33+
- 27017:27017
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Setup Node
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: "20.x"
43+
44+
- name: Enable Corepack & pin pnpm
45+
run: |
46+
corepack enable
47+
corepack prepare [email protected] --activate
48+
pnpm -v
49+
50+
- name: Install deps (workspace root)
51+
run: pnpm install --frozen-lockfile
52+
53+
54+
- name: Lint (execution service)
55+
run: pnpm --filter execution-service lint
56+
57+
- name: Set up Docker Buildx
58+
uses: docker/setup-buildx-action@v3
59+
60+
- name: Build Docker image
61+
uses: docker/build-push-action@v6
62+
with:
63+
context: backend/execution-service
64+
file: backend/execution-service/Dockerfile.execution
65+
push: false
66+
tags: execution-service:test
67+
cache-from: type=gha
68+
cache-to: type=gha,mode=max

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,16 @@ docker exec mongodb mongorestore --username admin --password password /data/back
107107
### Note:
108108
- You are required to develop individual microservices within separate folders within this repository.
109109
- The teaching team should be given access to the repositories as we may require viewing the history of the repository in case of any disputes or disagreements.
110+
111+
## Note for execution service
112+
- After run docker compose-up, run the next commands in terminal
113+
```bash
114+
chmod +x init-piston-languages.sh
115+
# Install language packages for Piston
116+
./init-piston-languages.sh
117+
```
118+
- APIs
119+
```bash
120+
POST /v1/execution/submit # submit language, code -> submit_id
121+
GET /v1/execution/submit/{submit_id} # get result -> submit_status = {pending | processing | done}, result
122+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/node_modules
2+
3+
.env
4+
5+
npm-debug.log
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MONGO_URI=mongodb://admin:password@mongodb:27017/peerprepExecutionServiceDB?authSource=admin
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
3+
.env
4+
5+
npm-debug.log
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Use Node.js 20 Alpine as base image
2+
FROM node:20-alpine
3+
4+
# Set working directory
5+
WORKDIR /app
6+
7+
# Install pnpm globally
8+
RUN npm install -g [email protected]
9+
10+
# Copy package files
11+
COPY package.json pnpm-lock.yaml* ./
12+
13+
# Install dependencies
14+
RUN pnpm install --no-frozen-lockfile
15+
16+
# Copy source code
17+
COPY . .
18+
19+
# Remove dev dependencies to reduce image size
20+
RUN pnpm prune --prod
21+
22+
# Create non-root user for security
23+
RUN addgroup -g 1001 -S nodejs
24+
RUN adduser -S execution-service -u 1011
25+
26+
# Change ownership of the app directory
27+
RUN chown -R execution-service:nodejs /app
28+
USER execution-service
29+
30+
# Start the application
31+
CMD ["pnpm", "start"]

0 commit comments

Comments
 (0)