-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathDockerfile
47 lines (36 loc) · 935 Bytes
/
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
ARG ENDPOINT=/admin
ARG PORT=80
FROM node:20-alpine AS build
ARG ENDPOINT
ENV ENDPOINT=$ENDPOINT
# Set up app directory
WORKDIR /app
COPY package.json ./
COPY package-lock.json ./
# Install all dependencies
RUN npm install
# Copy all required build files
COPY .eslintignore ./
COPY .eslintrc.cjs ./
COPY .npmrc ./
COPY .prettierignore ./
COPY .prettierrc ./
COPY postcss.config.cjs ./
COPY svelte.config.js ./
COPY tailwind.config.ts ./
COPY tsconfig.json ./
COPY vite.config.ts ./
# Copy source and static assets
COPY static/ ./static/
COPY src/ ./src/
# Build static application, endpoint is provided by $ENDPOINT
RUN npm run build
FROM caddy:latest
ARG ENDPOINT
ARG PORT
ENV PORT=${PORT}
WORKDIR /app
# Use the endpoint name as the directory so it can be served without URL stripping
COPY --from=build /app/build/ ./${ENDPOINT}
COPY Caddyfile /etc/caddy/Caddyfile
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]