1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 12:26:40 +07:00

add standalone build
All checks were successful
Build & Publish / Build & Publish (push) Successful in 3m35s

This commit is contained in:
Fedor Katurov 2025-03-24 17:42:00 +07:00
parent f083b488ba
commit a676e98174
7 changed files with 60 additions and 5 deletions

View file

@ -2,6 +2,8 @@
node_modules
out
dist
.husky
.next
.idea
.history
.vscode

View file

@ -11,7 +11,7 @@ steps:
image: plugins/docker
when:
branch:
- master
- never
environment:
NEXT_PUBLIC_API_HOST: https://vault48.org/api/
NEXT_PUBLIC_REMOTE_CURRENT: https://vault48.org/static/

View file

@ -35,7 +35,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/nextjs/Dockerfile
file: ./docker/nextjs-standalone/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View file

@ -0,0 +1,51 @@
# As written here:
# https://dev.to/leduc1901/reduce-docker-image-size-for-your-nextjs-app-5911
# Base ───────────────────────────────────────────────────────────────────────
FROM node:14-alpine as base
WORKDIR /opt/app
ENV PATH /opt/app/node_modules/.bin:$PATH
# Build ──────────────────────────────────────────────────────────────────────
FROM base as builder
ARG NEXT_PUBLIC_API_HOST
ARG NEXT_PUBLIC_REMOTE_CURRENT
ARG NEXT_PUBLIC_PUBLIC_HOST
ARG NEXT_PUBLIC_BOT_USERNAME
ENV NEXT_PUBLIC_API_HOST $NEXT_PUBLIC_API_HOST
ENV NEXT_PUBLIC_REMOTE_CURRENT $NEXT_PUBLIC_REMOTE_CURRENT
ENV NEXT_PUBLIC_PUBLIC_HOST $NEXT_PUBLIC_PUBLIC_HOST
ENV NEXT_PUBLIC_BOT_USERNAME $NEXT_PUBLIC_BOT_USERNAME
# ENV NEXT_PUBLIC_API_HOST https://vault48.org/api/
# ENV NEXT_PUBLIC_REMOTE_CURRENT https://vault48.org/static/
# ENV NEXT_PUBLIC_PUBLIC_HOST https://vault48.org/
# ENV NEXT_PUBLIC_BOT_USERNAME vault48bot
COPY package.json .
COPY yarn.lock .
RUN true \
&& yarn install --frozen-lockfile\
&& true
COPY . /opt/app
# pkg packs nodejs with given script, so we don't need it in next section
RUN yarn next build
FROM node:14-alpine as runner
WORKDIR /opt/app
COPY --from=builder /opt/app/public ./public
COPY --from=builder /opt/app/.next/standalone .
COPY --from=builder /opt/app/.next/static ./.next/static
EXPOSE 3000
ENTRYPOINT ["node", "server.js"]

View file

@ -9,6 +9,7 @@ const withTM = require('next-transpile-modules')([
module.exports = withBundleAnalyzer(
withTM({
output: 'standalone',
/** rewrite old-style node paths */
async rewrites() {
return [

View file

@ -58,6 +58,7 @@ const PhotoSwipe = observer(({ index, items }: Props) => {
return () => {
pswp.current?.off('close', hideModal);
// eslint-disable-next-line react-hooks/exhaustive-deps
pswp.current?.destroy();
};
}, [hideModal, items, index, isTablet]);

View file

@ -803,9 +803,9 @@ callsites@^3.0.0:
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
caniuse-lite@^1.0.30001332:
version "1.0.30001564"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001564.tgz"
integrity sha512-DqAOf+rhof+6GVx1y+xzbFPeOumfQnhYzVnZD6LAXijR77yPtm9mfOcqOnT3mpnJiZVT+kwLAFnRlZcIz+c6bg==
version "1.0.30001707"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001707.tgz"
integrity sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==
chalk@^2.0.0:
version "2.4.2"