diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..528ae7f --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build and push the Docker image + run: | + docker login --username 8-prime --password ${{ secrets.GH_PAT }} ghcr.io + docker build . --tag ghcr.io/8-prime/file-flow:latest + docker push ghcr.io/8-prime/file-flow:latest diff --git a/Dockerfile b/Dockerfile index 348aabb..5a9f9d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:latest as backend-build +FROM golang:1.24.3-bookworm AS backend-build WORKDIR /app @@ -12,7 +12,7 @@ RUN ls -la RUN CGO_ENABLED=1 GOOS=linux go build -o /fileflow ./cmd/api/main.go -FROM node:alpine AS frontend-build +FROM node:slim AS frontend-build WORKDIR /app COPY frontend/package.json . diff --git a/frontend/src/pages/Admin.tsx b/frontend/src/pages/Admin.tsx index 6ae2383..3447462 100644 --- a/frontend/src/pages/Admin.tsx +++ b/frontend/src/pages/Admin.tsx @@ -12,6 +12,7 @@ import { useDownloadInfos, useStats } from "@/api/api" import { Header } from "@/components/Header" import { Skeleton } from "@/components/ui/skeleton" import { DownloadInfo, FileInfo } from "@/models/models" +import { safeCopyToClipboard } from "@/lib/utils" export default function Admin() { @@ -24,14 +25,14 @@ export default function Admin() { }, [stats]) const copyLink = (id: string) => { - const link = `${window.location.origin}/download/${id}` - navigator.clipboard.writeText(link) + const link = `${window.location.origin}/files/${id}` + safeCopyToClipboard(link) toast("Link copied", { description: "The download link has been copied to your clipboard.", }) } - const deleteUpload = (id: string) => { + const deleteUpload = (_: string) => { // setUploads(uploads.filter((upload) => upload.id !== id)) // toast("Upload deleted", { // description: "The upload and all its files have been permanently deleted.", @@ -148,13 +149,6 @@ function UploadTable({ }) } - const humanizeBytes = (bytes: number, decimals: number = 2) => { - const units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; - - const base = Math.floor(Math.log(bytes) / Math.log(1024)); - return (bytes / Math.pow(1024, base)).toFixed(decimals) + " " + units[base]; - } - const toggleRow = (id: string) => { setExpandedRows((prev) => ({ ...prev,