Compare commits
2 Commits
2c6182ad7c
...
b6e36fdf00
Author | SHA1 | Date |
---|---|---|
Brieuc Dubois | b6e36fdf00 | |
Brieuc Dubois | c8edc250a1 |
|
@ -0,0 +1,12 @@
|
||||||
|
node_modules
|
||||||
|
.eslint*
|
||||||
|
.prettier*
|
||||||
|
.git*
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yaml
|
||||||
|
public
|
||||||
|
.svelte-kot
|
||||||
|
build
|
||||||
|
.dockerignore
|
||||||
|
*.sqlite
|
||||||
|
*.md
|
|
@ -2,8 +2,6 @@ name: Backend docker image
|
||||||
run-name: ${{ gitea.actor }} is runs ci pipeline
|
run-name: ${{ gitea.actor }} is runs ci pipeline
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
name: Frontend and backend docker image
|
||||||
|
run-name: ${{ gitea.actor }} is runs ci pipeline
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Extract tag
|
||||||
|
uses: olegtarasov/get-tag@v2.1.2
|
||||||
|
id: tagName
|
||||||
|
with:
|
||||||
|
tagRegex: "v(.*)"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
config-inline: |
|
||||||
|
[registry."git.bhasher.com"]
|
||||||
|
http = true
|
||||||
|
insecure = true
|
||||||
|
|
||||||
|
- name: Login
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: git.bhasher.com
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push frontend
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
||||||
|
tags: |
|
||||||
|
git.bhasher.com/bhasher/focus:latest
|
||||||
|
git.bhasher.com/bhasher/focus:${{ steps.tagName.outputs.tag }}
|
|
@ -2,8 +2,6 @@ name: Frontend docker image
|
||||||
run-name: ${{ gitea.actor }} is runs ci pipeline
|
run-name: ${{ gitea.actor }} is runs ci pipeline
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
FROM node:20 as frontend-builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY frontend/. .
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM golang:1.21.5 as backend-builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY backend/. .
|
||||||
|
RUN CGO_ENABLED=1 GOOS=linux go build -o main
|
||||||
|
|
||||||
|
FROM debian:stable-slim
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=frontend-builder /app /app/frontend
|
||||||
|
|
||||||
|
COPY --from=backend-builder /app/main /app/backend/main
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y curl
|
||||||
|
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
|
||||||
|
RUN apt-get install -y nodejs
|
||||||
|
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
EXPOSE 4173 3000
|
||||||
|
|
||||||
|
ENV DB_PATH=/data/db.sqlite
|
||||||
|
ENV PUBLIC_BACKEND_URL=http://localhost:3000
|
||||||
|
|
||||||
|
COPY run.sh /app/run.sh
|
||||||
|
RUN chmod +x /app/run.sh
|
||||||
|
|
||||||
|
CMD ["/app/run.sh"]
|
|
@ -6,7 +6,7 @@ import (
|
||||||
|
|
||||||
var db *sql.DB
|
var db *sql.DB
|
||||||
|
|
||||||
const DB_VERSION = 1
|
const DB_VERSION = 2
|
||||||
|
|
||||||
func InitDB(driver string, connStr string) error {
|
func InitDB(driver string, connStr string) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -13,4 +13,6 @@ COPY --from=frontend-builder /app .
|
||||||
|
|
||||||
EXPOSE 4173
|
EXPOSE 4173
|
||||||
|
|
||||||
|
ENV PUBLIC_BACKEND_URL=http://localhost:3000
|
||||||
|
|
||||||
CMD ["npm", "run", "preview", "--", "--port", "4173", "--host", "0.0.0.0"]
|
CMD ["npm", "run", "preview", "--", "--port", "4173", "--host", "0.0.0.0"]
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link rel="stylesheet" type="text/css" href="/css/global.css" />
|
<link rel="stylesheet" type="text/css" href="/css/global.css" />
|
||||||
<title>Focus.</title>
|
<title>Focus.</title>
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
%sveltekit.head%
|
%sveltekit.head%
|
||||||
</head>
|
</head>
|
||||||
<body data-sveltekit-preload-data="hover">
|
<body data-sveltekit-preload-data="hover">
|
||||||
|
|
|
@ -40,10 +40,10 @@
|
||||||
{:else}
|
{:else}
|
||||||
<div
|
<div
|
||||||
class="title"
|
class="title"
|
||||||
on:click={() => (location.href = `/${project.id}`)}
|
on:click={() => (location.href = `/project/${project.id}`)}
|
||||||
on:keydown={(e) => {
|
on:keydown={(e) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
location.href = `/${project.id}`;
|
location.href = `/project/${project.id}`;
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
import projectsApi from '$lib/api/projectsApi';
|
||||||
|
|
||||||
|
interface Shortcut {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
url: string;
|
||||||
|
icons: {
|
||||||
|
src: string;
|
||||||
|
sizes: string;
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function GET() {
|
||||||
|
const icon = {
|
||||||
|
src: '/img/icon.svg',
|
||||||
|
type: 'image/svg+xml',
|
||||||
|
sizes: 'any'
|
||||||
|
};
|
||||||
|
|
||||||
|
const projects = await projectsApi.getAll();
|
||||||
|
|
||||||
|
const shortcuts: Shortcut[] = projects.map((project) => {
|
||||||
|
return {
|
||||||
|
name: `Project ${project.title}`,
|
||||||
|
description: `Shortcut for project ${project.title}`,
|
||||||
|
url: `/${project.id}`,
|
||||||
|
icons: [icon]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const manifest = {
|
||||||
|
short_name: 'Focus',
|
||||||
|
name: 'Focus',
|
||||||
|
start_url: '/',
|
||||||
|
display: 'standalone',
|
||||||
|
icons: [icon],
|
||||||
|
shortcuts
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Response(JSON.stringify(manifest), {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/manifest+json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue