Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #12

Merged
merged 14 commits into from
Sep 6, 2024
Merged

Dev #12

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .devcontainer/Dockerfile.prod.deno

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: [ "main", "dev" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main", "dev" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
with:
cosign-release: 'v2.1.1'

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Fresh build directory
_fresh/
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM denoland/deno:latest

ENV PORT=80

VOLUME [ "/cert" ]

COPY . /app/
WORKDIR /app

CMD [ "task", "start" ]
12 changes: 0 additions & 12 deletions components/Button.tsx

This file was deleted.

18 changes: 18 additions & 0 deletions components/Cookies.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Head } from "$fresh/runtime.ts";
export function Cookies() {
return (
<>
<Head>
<script src="/cookies/cookie.js" defer></script>
</Head>
<div>
<div id="cookie-banner">
<p>
Diese Website verwendet keine Cookies.
<button id="cookie-btn">OK</button>
</p>
</div>
</div>
</>
);
}
9 changes: 9 additions & 0 deletions components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function Footer() {
return (
<footer class="footer">
<div class="container">
<p class="text-center">© 2024 AgD - Aktion gegen Drucker</p>
</div>
</footer>
);
}
41 changes: 41 additions & 0 deletions components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export function Header() {
return (
<header>
<div class="main">
<a href="#home" class="logo">
<img src="/images/agd-logo.png" alt="Logo" />
</a>

<nav class="navbar navbar-expand-lg">
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#services">Services</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">Über uns</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Kontakt</a>
</li>
</ul>
</div>
</nav>
</div>
</header>
);
}
18 changes: 3 additions & 15 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,8 @@
"preview": "deno run -A main.ts",
"update": "deno run -A -r https://fresh.deno.dev/update ."
},
"lint": {
"rules": {
"tags": [
"fresh",
"recommended"
]
}
},
"exclude": [
"**/_fresh/*"
],
"lint": { "rules": { "tags": ["fresh", "recommended"] } },
"exclude": ["**/_fresh/*"],
"imports": {
"$fresh/": "https://deno.land/x/fresh@1.6.8/",
"preact": "https://esm.sh/preact@10.19.6",
Expand All @@ -28,8 +19,5 @@
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
"$std/": "https://deno.land/std@0.216.0/"
},
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
}
"compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" }
}
14 changes: 13 additions & 1 deletion fresh.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
import { defineConfig } from "$fresh/server.ts";

export default defineConfig({});
const port = Number(Deno.env.get("DENO_PORT")) || 8000;

const certFile = Deno.env.get("DENO_CERTFILE");
const keyFile = Deno.env.get("DENO_KEYFILE");

const cert = certFile ? await Deno.readTextFile(certFile) : undefined;
const key = keyFile ? await Deno.readTextFile(keyFile) : undefined;

export default defineConfig({
port: port,
cert: cert,
key: key,
});
6 changes: 2 additions & 4 deletions fresh.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as $_app from "./routes/_app.tsx";
import * as $api_joke from "./routes/api/joke.ts";
import * as $greet_name_ from "./routes/greet/[name].tsx";
import * as $index from "./routes/index.tsx";
import * as $Counter from "./islands/Counter.tsx";

import { type Manifest } from "$fresh/server.ts";

const manifest = {
Expand All @@ -18,9 +18,7 @@ const manifest = {
"./routes/greet/[name].tsx": $greet_name_,
"./routes/index.tsx": $index,
},
islands: {
"./islands/Counter.tsx": $Counter,
},
islands: {},
baseUrl: import.meta.url,
} satisfies Manifest;

Expand Down
16 changes: 0 additions & 16 deletions islands/Counter.tsx

This file was deleted.

10 changes: 9 additions & 1 deletion routes/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import { type PageProps } from "$fresh/server.ts";
import { Header } from "../components/Header.tsx";
import { Footer } from "../components/Footer.tsx";
import { Cookies } from "../components/Cookies.tsx";
export default function App({ Component }: PageProps) {
return (
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>www.test</title>
<title>AgD - Aktion gegen Drucker</title>
<link rel="stylesheet" href="/styles.css" />
<link rel="stylesheet" href="/bootstrap/css/bootstrap.css" />
<script src="/bootstrap/js/bootstrap.bundle.js"></script>
</head>
<body>
<Header />
<Component />
<Cookies />
<Footer />
</body>
</html>
);
Expand Down
Loading
Loading