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
# ---------------
2020-12-16 13:52:59 +01:00
FROM node:14.15-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 \
2020-12-16 13:52:59 +01:00
libc6-compat \
2020-05-19 16:38:18 +02:00
python \
make \
g++
2020-12-16 13:52:59 +01:00
# Install app dependencies
2020-12-16 13:52:59 +01:00
COPY package.json package-lock.json ./
2022-02-23 13:57:39 +01:00
RUN npm ci
2020-12-16 13:52:59 +01:00
# ---------------
# 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}
2020-12-16 13:52:59 +01:00
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
2020-05-12 12:16:44 +02:00
# ---------------
2020-12-16 13:52:59 +01:00
# Release App
# ---------------
2020-11-19 22:56:39 +01:00
FROM node:14.15-alpine
2020-05-07 13:51:39 +02:00
WORKDIR /app
2020-12-16 13:52:59 +01:00
# 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}
2020-12-16 13:52:59 +01:00
ENV NEXT_TELEMETRY_DISABLED=1
2022-02-23 13:57:39 +01:00
COPY --from=build /app/package.json ./
2020-12-16 13:52:59 +01:00
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
2020-12-16 13:52:59 +01:00
2021-12-11 17:33:32 +01:00
# Copy NestJS files
COPY --from=build /app/dist/ ./dist
2020-12-16 13:52:59 +01:00
2021-12-11 17:33:32 +01:00
EXPOSE 3000
2020-04-13 07:30:19 +02:00
2021-12-11 17:33:32 +01:00
CMD [ "npm", "run", "start:prod" ]