Skip to content

Commit 9195eba

Browse files
committed
Update Dockerfile for deployment
1 parent a20d3e1 commit 9195eba

File tree

3 files changed

+17
-46
lines changed

3 files changed

+17
-46
lines changed

Dockerfile

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ RUN apk add --no-cache libc6-compat
99
WORKDIR /app
1010

1111
# Install dependencies based on the preferred package manager
12-
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
13-
RUN \
14-
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
15-
elif [ -f package-lock.json ]; then npm ci; \
16-
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
17-
else echo "Lockfile not found." && exit 1; \
18-
fi
12+
COPY package.json package-lock.json ./
13+
RUN npm ci
1914

2015

2116
# Rebuild the source code only when needed
@@ -24,43 +19,11 @@ WORKDIR /app
2419
COPY --from=deps /app/node_modules ./node_modules
2520
COPY . .
2621

27-
# Next.js collects completely anonymous telemetry data about general usage.
28-
# Learn more here: https://nextjs.org/telemetry
29-
# Uncomment the following line in case you want to disable telemetry during the build.
30-
# ENV NEXT_TELEMETRY_DISABLED=1
22+
RUN npm run storybook:build
3123

32-
RUN \
33-
if [ -f yarn.lock ]; then yarn run build; \
34-
elif [ -f package-lock.json ]; then npm run build; \
35-
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
36-
else echo "Lockfile not found." && exit 1; \
37-
fi
24+
FROM python:3-alpine
3825

39-
# Production image, copy all the files and run next
40-
FROM base AS runner
41-
WORKDIR /app
42-
43-
ENV NODE_ENV=production
44-
# Uncomment the following line in case you want to disable telemetry during runtime.
45-
# ENV NEXT_TELEMETRY_DISABLED=1
46-
47-
RUN addgroup --system --gid 1001 nodejs
48-
RUN adduser --system --uid 1001 nextjs
49-
50-
COPY --from=builder /app/public ./public
51-
52-
# Automatically leverage output traces to reduce image size
53-
# https://nextjs.org/docs/advanced-features/output-file-tracing
54-
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
55-
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
56-
57-
USER nextjs
58-
59-
EXPOSE 3000
60-
61-
ENV PORT=3000
26+
COPY --from=builder /app/storybook-static ./public
6227

63-
# server.js is created by next build from the standalone output
64-
# https://nextjs.org/docs/pages/api-reference/config/next-config-js/output
65-
ENV HOSTNAME="0.0.0.0"
66-
CMD ["node", "server.js"]
28+
EXPOSE 8080
29+
CMD ["python", "-m", "http.server", "8080", "--directory", "public"]

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"modern"
2222
],
2323
"scripts": {
24-
"dev": "storybook dev",
24+
"storybook:dev": "storybook dev",
25+
"storybook:build": "storybook build",
2526
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.app.json && tailwind build -i src/index.css -o dist/index.css && cp ./src/elastic-ui.css ./dist"
2627
},
2728
"dependencies": {

src/components/search/DefaultFacetOption.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { Label } from "@/components/ui/label"
33
import { PidDisplay } from "@/components/result/PidDisplay"
44
import { FacetValue } from "@elastic/search-ui"
55
import { FairDOFacetConfig } from "@/config/FairDOConfig"
6-
import { useMemo } from "react"
6+
import { useEffect, useMemo } from "react"
77
import { tryURLPrettyPrint } from "@/lib/utils"
8+
import { ontobeeResolver } from "@/lib/OntobeeResolver"
89

910
export function DefaultFacetOption({
1011
option,
@@ -27,6 +28,12 @@ export function DefaultFacetOption({
2728
} else return value
2829
}, [facetConfig.prettyPrintURLs, value])
2930

31+
useEffect(() => {
32+
if (value.startsWith("http://purl.obolibrary.org")) {
33+
ontobeeResolver.parse(value)
34+
}
35+
}, [value])
36+
3037
return (
3138
<div key={value} className="flex max-w-full items-center gap-2 break-words p-1 pb-2">
3239
<Checkbox id={value} checked={option.selected} onCheckedChange={(v) => (v ? onSelect(value) : onRemove(value))} />

0 commit comments

Comments
 (0)