Skip to content

Commit a2d7a4b

Browse files
committed
Add Docker and Fly.io deployment
1 parent 646006d commit a2d7a4b

File tree

6 files changed

+97
-0
lines changed

6 files changed

+97
-0
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
dist
3+
.git
4+
.angular
5+
.vscode
6+
*.md

.github/workflows/deploy.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Deploy to Fly.io
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
deploy:
8+
name: Deploy
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: superfly/flyctl-actions/setup-flyctl@master
15+
16+
- name: Deploy
17+
run: flyctl deploy --remote-only
18+
env:
19+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

.github/workflows/fly-deploy.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
2+
3+
name: Fly Deploy
4+
on:
5+
push:
6+
branches:
7+
- main
8+
jobs:
9+
deploy:
10+
name: Deploy app
11+
runs-on: ubuntu-latest
12+
concurrency: deploy-group # optional: ensure only one action runs at a time
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: superfly/flyctl-actions/setup-flyctl@master
16+
- run: flyctl deploy --remote-only
17+
env:
18+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Stage 1: Build
2+
FROM node:18-alpine AS builder
3+
WORKDIR /app
4+
COPY package*.json ./
5+
RUN npm ci
6+
COPY . .
7+
RUN npm run build
8+
9+
# Stage 2: Serve
10+
FROM nginx:alpine
11+
COPY nginx.conf /etc/nginx/conf.d/default.conf
12+
COPY --from=builder /app/dist/portfolio/browser /usr/share/nginx/html
13+
EXPOSE 80
14+
CMD ["nginx", "-g", "daemon off;"]

fly.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# fly.toml app configuration file generated for portfolio-still-lake-3526 on 2026-02-24T15:48:26-07:00
2+
#
3+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+
#
5+
6+
app = 'portfolio-still-lake-3526'
7+
primary_region = 'sjc'
8+
9+
[build]
10+
11+
[http_service]
12+
internal_port = 80
13+
force_https = true
14+
auto_stop_machines = 'stop'
15+
auto_start_machines = true
16+
min_machines_running = 0
17+
processes = ['app']
18+
19+
[[vm]]
20+
memory = '1gb'
21+
cpu_kind = 'shared'
22+
cpus = 1
23+
memory_mb = 1024

nginx.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
server {
2+
listen 80;
3+
server_name _;
4+
root /usr/share/nginx/html;
5+
index index.html;
6+
7+
# Angular SPA routing — send all unmatched routes to index.html
8+
location / {
9+
try_files $uri $uri/ /index.html;
10+
}
11+
12+
# Cache hashed static assets aggressively (Angular appends hashes on build)
13+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
14+
expires 1y;
15+
add_header Cache-Control "public, immutable";
16+
}
17+
}

0 commit comments

Comments
 (0)