Skip to content

Commit ca7507c

Browse files
committed
chore: update GitHub Actions workflow and Docker configuration for epicshop
1 parent 4133dd9 commit ca7507c

File tree

4 files changed

+107
-58
lines changed

4 files changed

+107
-58
lines changed

.github/workflows/validate.yml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ concurrency:
77
on:
88
push:
99
branches:
10-
- 'main'
11-
pull_request:
12-
branches:
13-
- 'main'
10+
- "main"
11+
pull_request: {}
12+
1413
jobs:
1514
setup:
15+
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: 20
28+
node-version: 24
2829

2930
- name: ▶️ Run setup script
3031
run: npm run setup
@@ -35,12 +36,35 @@ jobs:
3536
- name: ⬣ ESLint
3637
run: npm run lint
3738

39+
tests:
40+
name: 🧪 Test
41+
timeout-minutes: 10
42+
runs-on: ubuntu-latest
43+
# Use continue-on-error to ensure this job doesn't fail the workflow
44+
continue-on-error: true
45+
46+
steps:
47+
- name: ⬇️ Checkout repo
48+
uses: actions/checkout@v4
49+
50+
- name: ⎔ Setup node
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: 24
54+
55+
- name: 📦 Install dependencies
56+
run: npm ci
57+
58+
- name: 🧪 Run tests
59+
id: run_tests
60+
run: node ./epicshop/test.js ..s
61+
3862
deploy:
3963
name: 🚀 Deploy
64+
timeout-minutes: 10
4065
runs-on: ubuntu-latest
4166
# only deploy main branch on pushes on non-forks
42-
if:
43-
${{ github.ref == 'refs/heads/main' && github.event_name == 'push' &&
67+
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' &&
4468
github.repository_owner == 'epicweb-dev' }}
4569

4670
steps:
@@ -51,7 +75,9 @@ jobs:
5175
uses: superfly/flyctl-actions/[email protected]
5276

5377
- name: 🚀 Deploy
54-
run: flyctl deploy --remote-only
78+
run: flyctl deploy --remote-only --build-arg
79+
EPICSHOP_GITHUB_REPO=https://github.com/${{ github.repository }}
80+
--build-arg EPICSHOP_COMMIT_SHA=${{ github.sha }}
5581
working-directory: ./epicshop
5682
env:
5783
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

epicshop/Dockerfile

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
1-
FROM node:20-bookworm-slim as base
1+
FROM node:24-bookworm-slim as base
22

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

5+
# Build argument for GitHub repo URL
6+
ARG EPICSHOP_GITHUB_REPO
7+
ENV EPICSHOP_GITHUB_REPO=${EPICSHOP_GITHUB_REPO}
8+
59
ENV EPICSHOP_CONTEXT_CWD="/myapp/workshop-content"
10+
ENV EPICSHOP_HOME_DIR="/myapp/.epicshop"
611
ENV EPICSHOP_DEPLOYED="true"
712
ENV EPICSHOP_DISABLE_WATCHER="true"
813
ENV FLY="true"
914
ENV PORT="8080"
1015
ENV NODE_ENV="production"
1116

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+
1221
WORKDIR /myapp
1322

23+
# Clone the workshop repo during build time, excluding database files
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}
30+
1431
ADD . .
1532

1633
RUN npm install --omit=dev
1734

18-
CMD rm -rf ${EPICSHOP_CONTEXT_CWD} && \
19-
git clone https://github.com/epicweb-dev/tailwindcss-color-tokens ${EPICSHOP_CONTEXT_CWD} && \
20-
cd ${EPICSHOP_CONTEXT_CWD} && \
35+
RUN cd ${EPICSHOP_CONTEXT_CWD} && \
36+
npx epicshop warm
37+
38+
CMD cd ${EPICSHOP_CONTEXT_CWD} && \
2139
npx epicshop start

epicshop/fly.toml

Lines changed: 0 additions & 46 deletions
This file was deleted.

epicshop/fly.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
2+
#
3+
4+
app: "epicweb-dev-tailwindcss-color-tokens"
5+
primary_region: sjc
6+
kill_signal: SIGINT
7+
kill_timeout: 5s
8+
swap_size_mb: 512
9+
10+
experimental:
11+
auto_rollback: true
12+
13+
attached:
14+
secrets: {}
15+
16+
services:
17+
- processes:
18+
- app
19+
protocol: tcp
20+
internal_port: 8080
21+
22+
ports:
23+
- port: 80
24+
25+
handlers:
26+
- http
27+
force_https: true
28+
- port: 443
29+
30+
handlers:
31+
- tls
32+
- http
33+
34+
concurrency:
35+
type: connections
36+
hard_limit: 100
37+
soft_limit: 80
38+
39+
tcp_checks:
40+
- interval: 15s
41+
timeout: 2s
42+
grace_period: 1s
43+
44+
http_checks:
45+
- interval: 10s
46+
timeout: 2s
47+
grace_period: 5s
48+
method: get
49+
path: /resources/healthcheck
50+
protocol: http
51+
tls_skip_verify: false

0 commit comments

Comments
 (0)