Skip to content

Commit 53c8d64

Browse files
committed
chore: update CI workflow and Dockerfile for improved deployment process
1 parent d1c7c5b commit 53c8d64

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

.github/workflows/validate.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
jobs:
1414
setup:
1515
name: 🔧 Setup
16+
timeout-minutes: 10
1617
strategy:
1718
matrix:
1819
os: [ubuntu-latest, windows-latest, macos-latest]
@@ -24,7 +25,7 @@ jobs:
2425
- name: ⎔ Setup node
2526
uses: actions/setup-node@v4
2627
with:
27-
node-version: 22
28+
node-version: 24
2829

2930
- name: ▶️ Run setup script
3031
run: npm run setup
@@ -37,6 +38,7 @@ jobs:
3738

3839
tests:
3940
name: 🧪 Test
41+
timeout-minutes: 10
4042
runs-on: ubuntu-latest
4143
# Use continue-on-error to ensure this job doesn't fail the workflow
4244
continue-on-error: true
@@ -59,6 +61,7 @@ jobs:
5961

6062
deploy:
6163
name: 🚀 Deploy
64+
timeout-minutes: 10
6265
runs-on: ubuntu-latest
6366
# only deploy main branch on pushes on non-forks
6467
if:
@@ -73,7 +76,10 @@ jobs:
7376
uses: superfly/flyctl-actions/[email protected]
7477

7578
- name: 🚀 Deploy
76-
run: flyctl deploy --remote-only
79+
run:
80+
flyctl deploy --remote-only --build-arg
81+
EPICSHOP_GITHUB_REPO=https://github.com/${{ github.repository }}
82+
--build-arg EPICSHOP_COMMIT_SHA=${{ github.sha }}
7783
working-directory: ./epicshop
7884
env:
7985
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

epicshop/Dockerfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ FROM node:24-bookworm-slim as base
22

33
RUN apt-get update && apt-get install -y git
44

5-
ENV EPICSHOP_REPO=https://github.com/epicweb-dev/mcp-fundamentals
5+
# Build argument for GitHub repo URL
6+
ARG EPICSHOP_GITHUB_REPO
7+
ENV EPICSHOP_GITHUB_REPO=${EPICSHOP_GITHUB_REPO}
8+
69
ENV EPICSHOP_CONTEXT_CWD="/myapp/workshop-content"
710
ENV EPICSHOP_HOME_DIR="/myapp/.epicshop"
811
ENV EPICSHOP_DEPLOYED="true"
@@ -11,10 +14,19 @@ ENV FLY="true"
1114
ENV PORT="8080"
1215
ENV NODE_ENV="production"
1316

17+
# Build argument for commit SHA to bust cache when repo changes
18+
ARG EPICSHOP_COMMIT_SHA
19+
ENV EPICSHOP_COMMIT_SHA=${EPICSHOP_COMMIT_SHA}
20+
1421
WORKDIR /myapp
1522

1623
# Clone the workshop repo during build time, excluding database files
17-
RUN git clone --depth 1 ${EPICSHOP_REPO} ${EPICSHOP_CONTEXT_CWD}
24+
# Clone specific commit to keep image small while ensuring cache busting
25+
RUN git init ${EPICSHOP_CONTEXT_CWD} && \
26+
cd ${EPICSHOP_CONTEXT_CWD} && \
27+
git remote add origin ${EPICSHOP_GITHUB_REPO} && \
28+
git fetch --depth 1 origin ${EPICSHOP_COMMIT_SHA} && \
29+
git checkout ${EPICSHOP_COMMIT_SHA}
1830

1931
ADD . .
2032

0 commit comments

Comments
 (0)