Skip to content

Commit e3340cd

Browse files
committed
fix deploy
1 parent c0f8045 commit e3340cd

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

.github/workflows/validate.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: ⎔ Setup node
2525
uses: actions/setup-node@v4
2626
with:
27-
node-version: 23
27+
node-version: 24
2828

2929
- name: ▶️ Run setup script
3030
run: npm run setup
@@ -39,6 +39,7 @@ jobs:
3939

4040
deploy:
4141
name: 🚀 Deploy
42+
timeout-minutes: 10
4243
runs-on: ubuntu-latest
4344
# only deploy main branch on pushes on non-forks
4445
if:
@@ -53,7 +54,10 @@ jobs:
5354
uses: superfly/flyctl-actions/[email protected]
5455

5556
- name: 🚀 Deploy
56-
run: flyctl deploy --remote-only
57+
run:
58+
flyctl deploy --remote-only --build-arg
59+
EPICSHOP_GITHUB_REPO=https://github.com/${{ github.repository }}
60+
--build-arg EPICSHOP_COMMIT_SHA=${{ github.sha }}
5761
working-directory: ./epicshop
5862
env:
5963
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_GITHUB_REPO=https://github.com/epicweb-dev/advanced-vitest-patterns
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_GITHUB_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)