thunderhub/Dockerfile

69 lines
1.3 KiB
Docker
Raw Normal View History

2020-05-19 16:38:18 +02:00
# ---------------
# Install Dependencies
2020-05-19 16:38:18 +02:00
# ---------------
FROM node:18.18.2-alpine as deps
WORKDIR /app
# Install dependencies neccesary for node-gyp on node alpine
2020-05-19 16:38:18 +02:00
RUN apk add --update --no-cache \
libc6-compat \
2022-06-24 13:30:36 +02:00
python3 \
make \
g++
# Install app dependencies
COPY package.json package-lock.json ./
2022-02-23 13:57:39 +01:00
RUN npm ci
# ---------------
# Build App
# ---------------
FROM deps as build
WORKDIR /app
# Set env variables
ARG BASE_PATH=""
ENV BASE_PATH=${BASE_PATH}
2021-12-11 17:33:32 +01:00
ARG NODE_ENV="production"
ENV NODE_ENV=${NODE_ENV}
ENV NEXT_TELEMETRY_DISABLED=1
2020-08-09 16:03:18 +02:00
2021-12-11 17:33:32 +01:00
# Build the NestJS and NextJS application
2020-08-09 16:03:18 +02:00
COPY . .
2022-04-04 16:55:35 +02:00
RUN npm run build:nest
RUN npm run build:next
2020-08-09 16:03:18 +02:00
# Remove non production necessary modules
RUN npm prune --production
# ---------------
# Release App
# ---------------
FROM node:18.18.2-alpine as final
2020-05-07 13:51:39 +02:00
WORKDIR /app
# Set env variables
ARG BASE_PATH=""
ENV BASE_PATH=${BASE_PATH}
2021-12-11 17:33:32 +01:00
ARG NODE_ENV="production"
ENV NODE_ENV=${NODE_ENV}
ENV NEXT_TELEMETRY_DISABLED=1
2022-02-23 13:57:39 +01:00
COPY --from=build /app/package.json ./
COPY --from=build /app/node_modules/ ./node_modules
2021-12-11 17:33:32 +01:00
# Copy NextJS files
COPY --from=build /app/src/client/public ./src/client/public
COPY --from=build /app/src/client/next.config.js ./src/client/
2022-02-09 18:33:41 +01:00
COPY --from=build /app/src/client/.next/ ./src/client/.next
2021-12-11 17:33:32 +01:00
# Copy NestJS files
COPY --from=build /app/dist/ ./dist
2021-12-11 17:33:32 +01:00
EXPOSE 3000
2020-04-13 07:30:19 +02:00
CMD [ "npm", "run", "start:prod" ]