Skip to content

Commit c1923b5

Browse files
authored
Merge pull request #2 from mrmeaow/codex/add-responsive-uiux-and-ci-for-docker-image-m9at30
ci: add GitHub Actions workflow and GHCR Docker image build
2 parents 6b50915 + 5db2e87 commit c1923b5

7 files changed

Lines changed: 426 additions & 57 deletions

File tree

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git
2+
node_modules
3+
apps/*/node_modules
4+
apps/*/dist
5+
pnpm-debug.log
6+
.DS_Store

.github/workflows/ci-image.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI Build + Docker Image
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: ["main", "master", "work"]
7+
tags:
8+
- "v*"
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 22
25+
26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@v4
28+
with:
29+
version: 9
30+
31+
- name: Install dependencies
32+
run: pnpm install --no-frozen-lockfile
33+
34+
- name: Build workspace
35+
run: pnpm build
36+
37+
docker:
38+
runs-on: ubuntu-latest
39+
needs: build
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
44+
- name: Set up QEMU
45+
uses: docker/setup-qemu-action@v3
46+
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
50+
- name: Login to GHCR
51+
if: github.event_name == 'push'
52+
uses: docker/login-action@v3
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Extract Docker metadata
59+
id: meta
60+
uses: docker/metadata-action@v5
61+
with:
62+
images: ghcr.io/${{ github.repository }}
63+
tags: |
64+
type=ref,event=branch
65+
type=ref,event=tag
66+
type=sha
67+
type=raw,value=latest,enable={{is_default_branch}}
68+
69+
- name: Build and (conditionally) push image
70+
uses: docker/build-push-action@v6
71+
with:
72+
context: .
73+
file: ./Dockerfile
74+
platforms: linux/amd64
75+
push: ${{ github.event_name == 'push' }}
76+
tags: ${{ steps.meta.outputs.tags }}
77+
labels: ${{ steps.meta.outputs.labels }}
78+
cache-from: type=gha
79+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM node:22-bookworm-slim AS base
2+
WORKDIR /app
3+
RUN corepack enable
4+
5+
FROM base AS deps
6+
COPY package.json pnpm-workspace.yaml ./
7+
COPY apps/server/package.json apps/server/package.json
8+
COPY apps/web/package.json apps/web/package.json
9+
RUN pnpm install --no-frozen-lockfile
10+
11+
FROM deps AS build
12+
COPY . .
13+
RUN pnpm --filter @devsms/web build
14+
15+
FROM node:22-bookworm-slim AS runtime
16+
WORKDIR /app
17+
ENV NODE_ENV=production
18+
ENV PORT=4000
19+
ENV WEB_PORT=5153
20+
RUN corepack enable
21+
22+
COPY --from=deps /app/node_modules ./node_modules
23+
COPY --from=deps /app/apps/server/node_modules ./apps/server/node_modules
24+
COPY --from=deps /app/apps/web/node_modules ./apps/web/node_modules
25+
COPY --from=build /app/apps/server ./apps/server
26+
COPY --from=build /app/apps/web ./apps/web
27+
COPY scripts/start.sh ./scripts/start.sh
28+
29+
EXPOSE 4000 5153
30+
CMD ["bash", "./scripts/start.sh"]

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,25 @@ Canonical lifecycle:
121121
- `queued -> expired`
122122

123123
Provider mapping implemented in `apps/server/src/status-map.js`.
124+
125+
## Docker
126+
127+
Build and run locally:
128+
129+
```bash
130+
docker build -t devsms:local .
131+
docker run --rm -p 4000:4000 -p 5153:5153 devsms:local
132+
```
133+
134+
- API: `http://localhost:4000`
135+
- Web (SSR): `http://localhost:5153`
136+
137+
## CI / Image Publish
138+
139+
GitHub Actions workflow: `.github/workflows/ci-image.yml`
140+
141+
- Runs build checks on pull requests.
142+
- On push to `main` / `master` / `work` and tags (`v*`), builds Docker image and publishes to GHCR:
143+
- `ghcr.io/<owner>/<repo>:<branch>`
144+
- `ghcr.io/<owner>/<repo>:sha-...`
145+
- `ghcr.io/<owner>/<repo>:latest` (default branch only)

0 commit comments

Comments
 (0)