mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-13 13:07:29 +01:00
0bd1be0971
Dockerfile: update node version
53 lines
1.2 KiB
Docker
53 lines
1.2 KiB
Docker
# Build-time variables
|
|
ARG NODE_VERSION=16
|
|
ARG ALPINE_VERSION=3.15
|
|
|
|
|
|
# Build image
|
|
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS build
|
|
ARG BASE_PATH
|
|
ARG DATABASE_TYPE
|
|
|
|
ENV BASE_PATH=$BASE_PATH
|
|
ENV DATABASE_URL "postgresql://umami:umami@db:5432/umami"
|
|
ENV DATABASE_TYPE=$DATABASE_TYPE
|
|
|
|
WORKDIR /build
|
|
|
|
RUN yarn config set --home enableTelemetry 0
|
|
COPY package.json yarn.lock /build/
|
|
|
|
# Install only the production dependencies
|
|
RUN yarn install --production --frozen-lockfile
|
|
|
|
# Cache these modules for production
|
|
RUN cp -R node_modules/ prod_node_modules/
|
|
|
|
# Install development dependencies
|
|
RUN yarn install --frozen-lockfile
|
|
|
|
COPY . /build
|
|
RUN yarn next telemetry disable
|
|
RUN yarn build
|
|
|
|
|
|
# Production image
|
|
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS production
|
|
WORKDIR /app
|
|
|
|
# Copy cached dependencies
|
|
COPY --from=build /build/prod_node_modules ./node_modules
|
|
|
|
# Copy generated Prisma client
|
|
COPY --from=build /build/node_modules/.prisma/ ./node_modules/.prisma/
|
|
|
|
COPY --from=build /build/yarn.lock /build/package.json ./
|
|
COPY --from=build /build/.next ./.next
|
|
COPY --from=build /build/public ./public
|
|
COPY --from=build /build/scripts ./scripts
|
|
|
|
USER node
|
|
|
|
EXPOSE 3000
|
|
CMD ["yarn", "start"]
|