-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (32 loc) · 914 Bytes
/
Dockerfile
File metadata and controls
46 lines (32 loc) · 914 Bytes
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
# Set ARG variables with default values
ARG NODE_VERSION=${NODE_VERSION:-22.22.1}
ARG ALPINE_VERSION=${ALPINE_VERSION:-3.23}
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS base
ENV NODE_ENV=production
# Set working directory
WORKDIR /src
# Install Yarn v2 (Berry)
RUN corepack enable
# Build
FROM base AS build
# Copy necessary files for dependency installation
COPY package.json yarn.lock .yarnrc.yml ./
# Install project dependencies
RUN yarn install --immutable
COPY . ./
# Build Nuxt app for production
RUN yarn build
# Run
FROM base
COPY --from=build /src/.output /src/.output
# Expose production port
EXPOSE 3000
HEALTHCHECK \
--start-interval=1s \
--start-period=30s \
--interval=30s \
--timeout=20s \
--retries=5 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/ || exit 1
# Start Nuxt in production mode
CMD ["node", ".output/server/index.mjs"]