-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
75 lines (61 loc) · 1.71 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Set SPT Version
ARG SPT_VERSION=3.9.5
# Base image with common dependencies
FROM node:20.11.1-alpine AS base
RUN apk update && \
apk --no-cache --update add libgcc libstdc++ libc6-compat supervisor && \
rm -rf /var/cache/apk/*
FROM alpine as git
RUN apk add git git-lfs
# Fetch server components and build
FROM git AS fetch
ARG SPT_VERSION
ARG GIT_CLONE_PROTECTION_ACTIVE=false
WORKDIR /repo
RUN git clone https://dev.sp-tarkov.com/SPT/Server.git . && \
git checkout tags/$SPT_VERSION && \
git lfs fetch && \
git lfs pull
FROM node:20.11.1-alpine AS sptbuilder
RUN apk add git git-lfs
WORKDIR /app
COPY --from=fetch /repo .
WORKDIR /app/project
RUN yarn
RUN yarn run build:release
# Build the Nextjs App
FROM base AS builder
ARG SPT_VERSION
ENV NEXT_PUBLIC_SPT_VERSION=${SPT_VERSION}
WORKDIR /app/web
COPY web/package*.json ./
RUN npm install
COPY web/ .
RUN npm run build
# Final image combining everything
FROM base
WORKDIR /app
ENV NODE_ENV production
# Copy the built Next.js app
COPY --from=builder /app/web/public /app/web/public
COPY --from=builder /app/web/.next/standalone /app/web/
COPY --from=builder /app/web/.next/static /app/web/.next/static
COPY web/binaries /app/web/node_modules/node-7z-archive/binaries
# Copy the build SPT Server
COPY --from=sptbuilder /app/project/build /app
RUN cp -R /app/SPT_Data/Server /app/SPT_Data/Server.backup
RUN mkdir -p /app/BepInEx/plugins
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
VOLUME /app/user
VOLUME /app/SPT_Data/Server
# Copy Supervisord config
COPY supervisord.conf .
# Chown app
RUN chown -R node:node /app
# Switch to non-root user
USER node
# Expose ports (adjust if necessary)
EXPOSE 3000
# Entrypoint script
ENTRYPOINT ["/app/entrypoint.sh"]