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
Some checks failed
Build & Publish / Build & Publish (push) Has been cancelled

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@ name: Build & Publish
on: on:
push: push:
branches: [master] branches: [standalone]
jobs: jobs:
push_to_registry: push_to_registry:
@ -35,7 +35,7 @@ jobs:
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
file: ./docker/nextjs/Dockerfile file: ./docker/nextjs-standalone/Dockerfile
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}

View file

@ -0,0 +1,50 @@
# 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( module.exports = withBundleAnalyzer(
withTM({ withTM({
output: 'standalone',
/** rewrite old-style node paths */ /** rewrite old-style node paths */
async rewrites() { async rewrites() {
return [ return [

View file

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

View file

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