15 files changed
+4388
-63
No files matched your search
+1
-1
@@ -1,3 +1,3 @@
|
||||
NEXT_PUBLIC_IMMICH_URL=""
|
||||
IMMICH_URL=""
|
||||
IMMICH_API_KEY=""
|
||||
DATABASE_URL=""
|
||||
@@ -8,7 +8,7 @@ name: Docker Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- feat-docker
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
@@ -41,4 +41,5 @@ jobs:
|
||||
run: |
|
||||
docker build --build-arg VERSION=${{ env.VERSION }} \
|
||||
--push -t varunraj/immich-power-tools:${{ env.VERSION }} \
|
||||
-t varunraj/immich-power-tools:latest .
|
||||
-t varunraj/immich-power-tools:latest .
|
||||
|
||||
+40
-12
@@ -1,20 +1,48 @@
|
||||
# docker/dev.Dockerfile
|
||||
FROM oven/bun:latest
|
||||
# Source: https://github.com/vercel/next.js/blob/canary/examples/with-docker/README.md
|
||||
|
||||
WORKDIR /app/next-app
|
||||
|
||||
COPY package.json ./
|
||||
COPY bun.lockb ./
|
||||
|
||||
RUN bun install
|
||||
# Install dependencies only when needed
|
||||
FROM node:18-alpine AS deps
|
||||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
||||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
COPY package.json ./
|
||||
RUN npm install --frozen-lockfile
|
||||
|
||||
# Rebuild the source code only when needed
|
||||
FROM node:18-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
# Production image, copy all the files and run next
|
||||
FROM node:18-alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
RUN bun next build
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN addgroup -g 1001 -S nodejs
|
||||
RUN adduser -S nextjs -u 1001
|
||||
|
||||
# You only need to copy next.config.js if you are NOT using the default configuration
|
||||
# COPY --from=builder /app/next.config.js ./
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/package.json ./package.json
|
||||
|
||||
# Automatically leverage output traces to reduce image size
|
||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
# Set the command to run the application
|
||||
CMD ["bun", "run", "start", "-p", "3000", "-H", "0.0.0.0"]
|
||||
ENV PORT=3000
|
||||
|
||||
# Next.js collects completely anonymous telemetry data about general usage.
|
||||
# Learn more here: https://nextjs.org/telemetry
|
||||
# Uncomment the following line in case you want to disable telemetry.
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
@@ -32,7 +32,7 @@ docker compose up -d
|
||||
Copy paste the `.env.example` to `.env` and fill in the values.
|
||||
|
||||
```bash
|
||||
NEXT_PUBLIC_IMMICH_URL="" # Immich API URL
|
||||
IMMICH_URL="" # Immich API URL
|
||||
IMMICH_API_KEY="" # Immich API Key
|
||||
DATABASE_URL="" # Postgress Database URL
|
||||
```
|
||||
|
||||
+1
-3
@@ -2,10 +2,8 @@ version: '3.8'
|
||||
|
||||
services:
|
||||
immich_power_tools:
|
||||
image: varunraj/immich-power-tools
|
||||
container_name: immich_power_tools
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "3000:3000"
|
||||
env_file:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: false,
|
||||
output: 'standalone'
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"start": "next start -p ${PORT:=3000} -H ${HOST:=0.0.0.0}",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"author": {
|
||||
|
||||
@@ -12,41 +12,6 @@ import PersonHideCell from "./PersonHideCell";
|
||||
import { PeoplePagination } from "./PeoplePagination";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
const columns: ColumnDef<IPerson>[] = [
|
||||
{
|
||||
header: "Name",
|
||||
accessorKey: "name",
|
||||
cell: ({ row }) => <PersonItem person={row.original} />,
|
||||
},
|
||||
{
|
||||
header: "Birth Date",
|
||||
accessorKey: "birthDate",
|
||||
cell: ({ row }) => <PersonBirthdayCell person={row.original} />,
|
||||
},
|
||||
{
|
||||
header: "Hidden",
|
||||
accessorKey: "isHidden",
|
||||
cell: ({ row }) => (
|
||||
<PersonHideCell person={row.original} />
|
||||
),
|
||||
},
|
||||
{
|
||||
header: "Link",
|
||||
accessorKey: "id",
|
||||
cell: ({ row }) => (
|
||||
<Link href={`${ENV.IMMICH_URL}/people/${row.original.id}`} target="_blank">
|
||||
View
|
||||
</Link>
|
||||
)
|
||||
},
|
||||
{
|
||||
header: "Updated At",
|
||||
accessorKey: "updatedAt",
|
||||
cell: ({ row }) => <span>{new Date(
|
||||
row.original.updatedAt
|
||||
).toDateString()}</span>,
|
||||
},
|
||||
];
|
||||
|
||||
export default function PeopleList() {
|
||||
const router = useRouter()
|
||||
|
||||
@@ -9,11 +9,13 @@ import clsx from "clsx";
|
||||
import Link from "next/link";
|
||||
import { ENV } from "@/config/environment";
|
||||
import { ArrowUpRight } from "lucide-react";
|
||||
import { useConfig } from "@/contexts/ConfigContext";
|
||||
|
||||
interface IProps {
|
||||
person: IPerson;
|
||||
}
|
||||
export default function PersonItem({ person }: IProps) {
|
||||
const { immichURL } = useConfig();
|
||||
const [editMode, setEditMode] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [formData, setFormData] = useState(person);
|
||||
@@ -75,7 +77,7 @@ export default function PersonItem({ person }: IProps) {
|
||||
<div className="absolute top-2 left-2 group-hover:block hidden">
|
||||
<Link
|
||||
className="bg-green-300 block rounded-lg px-2 py-1 text-sm"
|
||||
href={`${ENV.IMMICH_URL}/people/${person.id}`}
|
||||
href={`${immichURL}/people/${person.id}`}
|
||||
target="_blank"
|
||||
>
|
||||
<ArrowUpRight size={16} />
|
||||
|
||||
@@ -11,12 +11,14 @@ import { useTheme } from "next-themes";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
import Image from "next/image";
|
||||
import { useConfig } from "@/contexts/ConfigContext";
|
||||
|
||||
const ThemeSwitcher = dynamic(() => import("@/components/shared/ThemeSwitcher"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
export default function Sidebar() {
|
||||
const { immichURL } = useConfig();
|
||||
const router = useRouter();
|
||||
const { pathname } = router;
|
||||
|
||||
@@ -58,8 +60,8 @@ export default function Sidebar() {
|
||||
<div>
|
||||
<div className="flex flex-col gap-1 text-xs text-center py-2">
|
||||
<p className="text-muted-foreground font-mono">Connected to</p>
|
||||
<Link href={ENV.IMMICH_URL} target="_blank" className="font-mono">
|
||||
{ENV.IMMICH_URL}
|
||||
<Link href={immichURL} target="_blank" className="font-mono">
|
||||
{immichURL}
|
||||
</Link>
|
||||
</div>
|
||||
<div className="border text-muted-foreground text-xs text-center py-2">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const ENV = {
|
||||
IMMICH_URL: process.env.NEXT_PUBLIC_IMMICH_URL as string,
|
||||
IMMICH_URL: process.env.IMMICH_URL as string,
|
||||
IMMICH_API_KEY: process.env.IMMICH_API_KEY as string,
|
||||
DATABASE_URL: process.env.DATABASE_URL as string,
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
interface ConfigContextType {
|
||||
immichURL: string;
|
||||
}
|
||||
|
||||
const ConfigContext = createContext<ConfigContextType>({
|
||||
immichURL: "",
|
||||
});
|
||||
|
||||
export default ConfigContext;
|
||||
|
||||
export const useConfig = () => {
|
||||
const context = useContext(ConfigContext) as ConfigContextType;
|
||||
return context;
|
||||
}
|
||||
+29
-4
@@ -1,9 +1,34 @@
|
||||
import RootLayout from "@/components/layouts/RootLayout";
|
||||
import "@/styles/globals.scss";
|
||||
import type { AppProps } from "next/app";
|
||||
import { ThemeProvider } from 'next-themes'
|
||||
import { ThemeProvider } from "next-themes";
|
||||
import { ENV } from "@/config/environment";
|
||||
import ConfigContext from "@/contexts/ConfigContext";
|
||||
|
||||
|
||||
export default function App({ Component, pageProps }: AppProps) {
|
||||
return <ThemeProvider attribute="class" storageKey = 'theme'><RootLayout><Component {...pageProps} /></RootLayout></ThemeProvider>
|
||||
interface AppPropsWithProps extends AppProps {
|
||||
props: {
|
||||
immichURL: string;
|
||||
};
|
||||
}
|
||||
const App = ({ Component, pageProps, ...props }: AppPropsWithProps) => {
|
||||
console.log("App -> pageProps", props);
|
||||
return (
|
||||
<ConfigContext.Provider value={props.props}>
|
||||
<ThemeProvider attribute="class" storageKey="theme">
|
||||
<RootLayout>
|
||||
<Component {...pageProps} />
|
||||
</RootLayout>
|
||||
</ThemeProvider>
|
||||
</ConfigContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
App.getInitialProps = async () => {
|
||||
return {
|
||||
props: {
|
||||
immichURL: ENV.IMMICH_URL,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default App;
|
||||
Reference in new issue
Block a user