-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (42 loc) · 1.32 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
# build
# FROM node:20.10-alpine AS build
# RUN mkdir -p /build
# WORKDIR /build
# ADD package.json /build/package.json
# ADD package-lock.json /build/package-lock.json
# RUN npm ci
# ADD . /build
# RUN npm run build
# # release
# FROM nginx:1.23.2-alpine AS release
# # Replace the default config
# ADD admin.mustachebash.conf /etc/nginx/conf.d/default.conf
# COPY --from=build /build/dist /static
# WORKDIR /static
# Base
FROM node:23.6-alpine3.20 AS base
RUN mkdir -p /build
WORKDIR /build
COPY package.json package-lock.json ./
# Build dependencies
FROM base AS build-deps
# https://docs.docker.com/build/guide/mounts/
RUN --mount=type=cache,target=/root/.npm \
npm ci
# Build
FROM build-deps AS build
# https://docs.docker.com/build/guide/mounts/
RUN --mount=type=cache,target=/root/.npm \
--mount=type=bind,source=astro.config.mjs,target=astro.config.mjs \
--mount=type=bind,source=tsconfig.json,target=tsconfig.json \
--mount=type=bind,source=types.d.ts,target=types.d.ts \
--mount=type=bind,source=src,target=src \
--mount=type=bind,source=public,target=public \
--mount=type=bind,source=.env.production,target=.env.production \
npm run build
# release
FROM nginx:1.27.3-alpine AS release
# Replace the default config
ADD admin.mustachebash.conf /etc/nginx/conf.d/default.conf
COPY --from=build /build/dist /static
WORKDIR /static