forked from pruvious/pruvious
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (35 loc) · 1.38 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Use the latest Node.js image as the base
FROM node:current as base
LABEL authors="pruvious"
# Create and set the working directory
RUN mkdir -p /app
WORKDIR /app
# Set the environment to production
ENV NODE_ENV=production
# Build stage
FROM base as build
# Install necessary tools for the build process
RUN apt-get update -y && apt-get install -y openssl git
# Copy package.json and package-lock.json (if available)
COPY --link package.json package-lock.json ./
# Install all dependencies, including devDependencies
# --production=false ensures devDependencies are installed
# --arch=x64 specifies the architecture - this has been added to ensure the build output runs as expected if built on non x64 processors but has to run on an x64 server
# If you plan on running pruvious on an arm or non x64 based host, make sure to remove this argument!
RUN npm install --production=false --arch=x64
# Copy the rest of the application code
COPY --link . .
# Build the Nuxt.js application
RUN npm run build
# Production stage
FROM base
WORKDIR /app
# Set the PORT environment variable
ENV PORT=$PORT
ENV NODE_ENV=production
# Copy the built application from the build stage
COPY --from=build /app/.output /app/.output
# Optional: Uncomment if you need unbundled dependencies
# COPY --from=build /src/node_modules /src/node_modules
# Command to run the application
CMD [ "node", ".output/server/index.mjs" ]