mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
build: improve dockerfile (#851)
Co-authored-by: MatriQi <matri@aifi.io>
This commit is contained in:
parent
155a4733f6
commit
5b06ded0b1
1
sdks/nodejs-client/.gitignore
vendored
1
sdks/nodejs-client/.gitignore
vendored
|
@ -42,7 +42,6 @@ package-lock.json
|
|||
.pnp.cjs
|
||||
.pnp.loader.mjs
|
||||
.yarn/
|
||||
yarn.lock
|
||||
.yarnrc.yml
|
||||
|
||||
# pmpm
|
||||
|
|
1
web/.gitignore
vendored
1
web/.gitignore
vendored
|
@ -42,7 +42,6 @@ package-lock.json
|
|||
.pnp.cjs
|
||||
.pnp.loader.mjs
|
||||
.yarn/
|
||||
yarn.lock
|
||||
.yarnrc.yml
|
||||
|
||||
# pmpm
|
||||
|
|
|
@ -1,32 +1,48 @@
|
|||
FROM node:18.17.0-alpine
|
||||
# base image
|
||||
FROM node:18.17.0-alpine AS base
|
||||
|
||||
# install packages
|
||||
FROM base as packages
|
||||
LABEL maintainer="takatost@gmail.com"
|
||||
|
||||
WORKDIR /app/web
|
||||
|
||||
COPY package.json .
|
||||
COPY yarn.lock .
|
||||
|
||||
RUN yarn --only=prod
|
||||
|
||||
|
||||
# build resources
|
||||
FROM base as builder
|
||||
WORKDIR /app/web
|
||||
COPY --from=packages /app/web/ .
|
||||
COPY . .
|
||||
|
||||
RUN yarn build
|
||||
|
||||
|
||||
# production stage
|
||||
FROM base as production
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV EDITION SELF_HOSTED
|
||||
ENV DEPLOY_ENV PRODUCTION
|
||||
ENV CONSOLE_API_URL http://127.0.0.1:5001
|
||||
ENV APP_API_URL http://127.0.0.1:5001
|
||||
ENV PORT 3000
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
WORKDIR /app/web
|
||||
COPY --from=builder /app/web/.next/standalone ./
|
||||
COPY --from=builder /app/web/.next/static ./.next/static
|
||||
|
||||
COPY package.json /app/web/package.json
|
||||
|
||||
RUN npm install pm2 -g
|
||||
|
||||
RUN npm install --only=prod
|
||||
|
||||
COPY . /app/web/
|
||||
|
||||
RUN npm run build
|
||||
|
||||
COPY docker/pm2.json /app/web/pm2.json
|
||||
COPY docker/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
COPY docker/entrypoint.sh ./entrypoint.sh
|
||||
RUN chmod +x ./entrypoint.sh
|
||||
|
||||
ARG COMMIT_SHA
|
||||
ENV COMMIT_SHA ${COMMIT_SHA}
|
||||
|
||||
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]
|
|
@ -19,5 +19,4 @@ fi
|
|||
|
||||
export NEXT_PUBLIC_SENTRY_DSN=${SENTRY_DSN}
|
||||
|
||||
/usr/local/bin/pm2 -v
|
||||
/usr/local/bin/pm2-runtime start /app/web/pm2.json
|
||||
node ./server.js
|
|
@ -38,6 +38,7 @@ const nextConfig = {
|
|||
},
|
||||
]
|
||||
},
|
||||
output: 'standalone',
|
||||
}
|
||||
|
||||
module.exports = withMDX(nextConfig)
|
||||
|
|
5795
web/yarn.lock
Normal file
5795
web/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user