Skip to content

Commit

Permalink
🚧 some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredkiss3 committed Sep 23, 2024
1 parent 8fa3dbc commit e2307f2
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 18 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build-push-image-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Push Image in DEV
on:
pull_request:
workflow_dispatch:

jobs:
build-push-docs:
name: Build and Push Website
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache pnpm dependencies
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.OS }}-pnpm-cache-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.OS }}-pnpm-cache-
- name: Build docs with node
run: |
npm install -g pnpm@8
pnpm install --frozen-lockfile
pnpm run build
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CONTAINER_REGISTRY_PAT }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/fredkiss3/fredkiss-dev:pr-${{ github.event.pull_request.number }},ghcr.io/fredkiss3/fredkiss-dev:${{ github.sha }}
cache-from: |
type=registry,ref=ghcr.io/fredkiss3/fredkiss-dev:pr-${{ github.event.pull_request.number }}
type=registry,ref=ghcr.io/fredkiss3/fredkiss-dev:latest
cache-to: type=inline
14 changes: 6 additions & 8 deletions .github/workflows/build-push-image.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: Build and Push Canary Images
name: Build and Push production Image
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-push-docs:
name: Build and Push Zane Documentation
name: Build and Push Website
runs-on: ubuntu-latest
permissions:
packages: write
Expand All @@ -21,7 +19,7 @@ jobs:
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 20
- name: Cache pnpm dependencies
uses: actions/cache@v3
with:
Expand All @@ -33,7 +31,7 @@ jobs:
run: |
npm install -g pnpm@8
pnpm install --frozen-lockfile
pnpm --prefix docs run build
pnpm run build
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand All @@ -51,7 +49,7 @@ jobs:
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/fredkiss3/fredkiss-dev:canary,ghcr.io/fredkiss3/fredkiss-dev:${{ github.sha }}
tags: ghcr.io/fredkiss3/fredkiss-dev:latest,ghcr.io/fredkiss3/fredkiss-dev:${{ github.sha }}
cache-from: |
type=registry,ref=ghcr.io/fredkiss3/fredkiss-dev:canary
type=registry,ref=ghcr.io/fredkiss3/fredkiss-dev:latest
cache-to: type=inline
19 changes: 19 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
:80 {
# Set the root directory for static files
root * /var/www/html
file_server

@assets {
path_regexp assets \.(css|js|png|jpg|jpeg|gif|svg|woff|woff2|eot|ttf|otf)$
}

header @assets Cache-Control "public, max-age=31536000, immutable"

handle_errors {
@404 {
expression {http.error.status_code} == 404
}
rewrite @404 ./404.html
file_server
}
}
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Webapp based on caddy
FROM caddy:2.8-alpine

WORKDIR /var/www/html

COPY ./dist/ ./
COPY ./Caddyfile /etc/caddy/Caddyfile
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This is my portfolio.
pnpm run dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
Open [http://localhost:4321](http://localhost:4321) with your browser to see the result.

6. **Open the source code and start rocking ! 😎**

19 changes: 10 additions & 9 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ import path from "node:path";
import { defineConfig } from "astro/config";

import tailwind from "@astrojs/tailwind";
import sitemap from "@astrojs/sitemap";
const __dirname = import.meta.dirname;

// https://astro.build/config
export default defineConfig({
integrations: [tailwind()],
vite: {
resolve: {
alias: {
"~": path.resolve(__dirname, "./src"),
},
},
},
});
integrations: [tailwind(), sitemap()],
vite: {
resolve: {
alias: {
"~": path.resolve(__dirname, "./src"),
},
},
},
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/sitemap": "^3.1.6",
"@astrojs/tailwind": "^5.1.1",
"astro": "^4.15.8",
"tailwindcss": "^3.4.12",
Expand Down
40 changes: 40 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
User-agent: *
Allow: /
Sitemap: https://fredkiss.dev/sitemap-index.xml

0 comments on commit e2307f2

Please sign in to comment.