diff --git a/.github/workflows/build-push-image-dev.yaml b/.github/workflows/build-push-image-dev.yaml new file mode 100644 index 0000000..40804fa --- /dev/null +++ b/.github/workflows/build-push-image-dev.yaml @@ -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 \ No newline at end of file diff --git a/.github/workflows/build-push-image.yaml b/.github/workflows/build-push-image.yaml index 20f2322..9528d1e 100644 --- a/.github/workflows/build-push-image.yaml +++ b/.github/workflows/build-push-image.yaml @@ -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 @@ -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: @@ -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 @@ -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 \ No newline at end of file diff --git a/Caddyfile b/Caddyfile index e69de29..20b7693 100644 --- a/Caddyfile +++ b/Caddyfile @@ -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 + } +} diff --git a/Dockerfile b/Dockerfile index e69de29..da1afe0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,7 @@ +# Webapp based on caddy +FROM caddy:2.8-alpine + +WORKDIR /var/www/html + +COPY ./dist/ ./ +COPY ./Caddyfile /etc/caddy/Caddyfile diff --git a/README.md b/README.md index 8cfa00b..68e9da3 100644 --- a/README.md +++ b/README.md @@ -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 ! 😎** diff --git a/astro.config.mjs b/astro.config.mjs index 5c5093b..1fa3f15 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -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"), + }, + }, + }, +}); \ No newline at end of file diff --git a/package.json b/package.json index 4efc73d..5a55dbf 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 68d00a4..78303a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ dependencies: '@astrojs/check': specifier: ^0.9.3 version: 0.9.3(typescript@5.6.2) + '@astrojs/sitemap': + specifier: ^3.1.6 + version: 3.1.6 '@astrojs/tailwind': specifier: ^5.1.1 version: 5.1.1(astro@4.15.8)(tailwindcss@3.4.12) @@ -133,6 +136,14 @@ packages: prismjs: 1.29.0 dev: false + /@astrojs/sitemap@3.1.6: + resolution: {integrity: sha512-1Qp2NvAzVImqA6y+LubKi1DVhve/hXXgFvB0szxiipzh7BvtuKe4oJJ9dXSqaubaTkt4nMa6dv6RCCAYeB6xaQ==} + dependencies: + sitemap: 7.1.2 + stream-replace-string: 2.0.0 + zod: 3.23.8 + dev: false + /@astrojs/tailwind@5.1.1(astro@4.15.8)(tailwindcss@3.4.12): resolution: {integrity: sha512-LwurA10uIKcGRxQP2R81RvAnBT0WPKzBntXZBF4hrAefDgM5Uumn0nsGr6tdIjSARgYz4X+Cq/Vh78t3bql3yw==} peerDependencies: @@ -1127,11 +1138,21 @@ packages: '@types/unist': 3.0.3 dev: false + /@types/node@17.0.45: + resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} + dev: false + /@types/node@22.5.5: resolution: {integrity: sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==} dependencies: undici-types: 6.19.8 + /@types/sax@1.2.7: + resolution: {integrity: sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==} + dependencies: + '@types/node': 22.5.5 + dev: false + /@types/unist@3.0.3: resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} dev: false @@ -3268,6 +3289,10 @@ packages: queue-microtask: 1.2.3 dev: false + /sax@1.4.1: + resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==} + dev: false + /section-matter@1.0.0: resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==} engines: {node: '>=4'} @@ -3358,6 +3383,17 @@ packages: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: false + /sitemap@7.1.2: + resolution: {integrity: sha512-ARCqzHJ0p4gWt+j7NlU5eDlIO9+Rkr/JhPFZKKQ1l5GCus7rJH4UdrlVAh0xC/gDS/Qir2UMxqYNHtsKr2rpCw==} + engines: {node: '>=12.0.0', npm: '>=5.6.0'} + hasBin: true + dependencies: + '@types/node': 17.0.45 + '@types/sax': 1.2.7 + arg: 5.0.2 + sax: 1.4.1 + dev: false + /source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} @@ -3376,6 +3412,10 @@ packages: engines: {node: '>=18'} dev: false + /stream-replace-string@2.0.0: + resolution: {integrity: sha512-TlnjJ1C0QrmxRNrON00JvaFFlNh5TTG00APw23j74ET7gkQpTASi6/L2fuiav8pzK715HXtUeClpBTw2NPSn6w==} + dev: false + /string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..e3939c6 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,3 @@ +User-agent: * +Allow: / +Sitemap: https://fredkiss.dev/sitemap-index.xml \ No newline at end of file