-
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (34 loc) · 1.12 KB
/
Dockerfile
File metadata and controls
46 lines (34 loc) · 1.12 KB
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
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
COPY frontend/package*.json ./frontend/
RUN cd frontend && npm ci
COPY frontend/ ./frontend/
ARG APP_VERSION=unknown
ARG GITHUB_REPO=lklynet/aurral
ENV VITE_APP_VERSION=$APP_VERSION
ENV VITE_GITHUB_REPO=$GITHUB_REPO
RUN cd frontend && npm run build
FROM node:20-alpine
ARG APP_VERSION=unknown
ENV APP_VERSION=$APP_VERSION
WORKDIR /app
RUN apk add --no-cache su-exec && \
addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001 && \
mkdir -p /app/backend/data && \
chown -R nodejs:nodejs /app
COPY package*.json ./
RUN apk add --no-cache python3 make g++ && npm ci --omit=dev --ignore-scripts
COPY backend/package*.json ./backend/
RUN cd backend && npm ci --omit=dev --ignore-scripts
RUN cd backend && npm rebuild --build-from-source
COPY backend/ ./backend/
COPY server.js loadEnv.js ./
COPY --from=builder /app/frontend/dist ./frontend/dist
COPY backend/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
chown -R nodejs:nodejs /app
EXPOSE 3001
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["node", "server.js"]