forked from Ravinou/borgwarehouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (33 loc) · 1.4 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
FROM node:18-bookworm-slim as base
# build stage
FROM base AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --only=production
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN sed -i "s/images:/output: 'standalone',images:/" next.config.js
RUN npm run build
# run stage
FROM base AS runner
ENV NODE_ENV production
RUN apt-get update && apt-get install -y \
curl jq jc borgbackup openssh-server sudo cron && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN echo "borgwarehouse ALL=(ALL) NOPASSWD: /usr/sbin/service ssh restart" >> /etc/sudoers
RUN echo "borgwarehouse ALL=(ALL) NOPASSWD: /usr/sbin/service cron restart" >> /etc/sudoers
RUN groupadd borgwarehouse
RUN useradd -m -g borgwarehouse borgwarehouse
RUN cp /etc/ssh/sshd_config /etc/ssh/moduli /home/borgwarehouse/
WORKDIR /home/borgwarehouse/app
COPY --from=builder --chown=borgwarehouse:borgwarehouse /app/docker-bw-init.sh /app/LICENSE ./
COPY --from=builder --chown=borgwarehouse:borgwarehouse /app/helpers/shells ./helpers/shells
COPY --from=builder --chown=borgwarehouse:borgwarehouse /app/.next/standalone ./
COPY --from=builder --chown=borgwarehouse:borgwarehouse /app/public ./public
COPY --from=builder --chown=borgwarehouse:borgwarehouse /app/.next/static ./.next/static
USER borgwarehouse
EXPOSE 3000 22
ENTRYPOINT ["./docker-bw-init.sh"]
CMD ["node", "server.js"]