-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (49 loc) · 2.24 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (49 loc) · 2.24 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
47
48
49
50
51
52
53
54
ARG NODE_BASE_IMAGE=node:24.4.0-bookworm-slim
FROM $NODE_BASE_IMAGE AS frontend-build-base
WORKDIR /app
RUN apt update && apt install -y --no-install-recommends git curl ca-certificates xz-utils
FROM frontend-build-base AS frontend-pruner
WORKDIR /app
# Use the exact version from the root package.json
RUN npm install -g turbo@2.8.10
COPY . .
RUN turbo prune @ryot/frontend --docker
FROM frontend-build-base AS frontend-builder
WORKDIR /app
COPY --from=frontend-pruner /app/out/json/ .
RUN yarn install
COPY --from=frontend-pruner /app/out/full/ .
COPY --from=frontend-pruner /app/tsconfig.options.json .
RUN yarn turbo run build --filter=@ryot/frontend
RUN yarn workspaces focus @ryot/frontend --production
FROM --platform=${BUILDPLATFORM} alpine AS artifact
COPY artifact/ /artifact/
ARG TARGETARCH
ENV TARGETARCH=${TARGETARCH}
RUN mv /artifact/backend-${TARGETARCH}/backend /artifact/backend
RUN chmod +x /artifact/backend
FROM $NODE_BASE_IMAGE
ARG TARGETARCH
ENV TARGETARCH=${TARGETARCH}
LABEL org.opencontainers.image.source="https://github.com/IgnisDa/ryot"
LABEL org.opencontainers.image.description="The only self hosted tracker you will ever need!"
ENV FRONTEND_UMAMI_SCRIPT_URL="https://umami.diptesh.me/script.js"
ENV FRONTEND_UMAMI_WEBSITE_ID="5ecd6915-d542-4fda-aa5f-70f09f04e2e0"
RUN apt-get update && apt-get install -y --no-install-recommends wget curl ca-certificates procps libc6 && rm -rf /var/lib/apt/lists/*
COPY --from=caddy:2.9.1 /usr/bin/caddy /usr/local/bin/caddy
RUN npm install --global concurrently@9.1.2 && concurrently --version
RUN useradd -m -u 1001 ryot
COPY ci/run-container.sh /usr/local/bin/run-container.sh
RUN chmod +x /usr/local/bin/run-container.sh
WORKDIR /home/ryot
USER ryot
COPY ci/Caddyfile /etc/caddy/Caddyfile
COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/node_modules ./node_modules
COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/package.json ./package.json
COPY --from=frontend-builder --chown=ryot:ryot /app/apps/frontend/build ./build
COPY --from=artifact --chown=ryot:ryot /artifact/backend /usr/local/bin/backend
RUN ldd /usr/local/bin/backend 2>&1 \
| tee /tmp/backend-ldd \
&& ! grep -q "not found" /tmp/backend-ldd \
&& rm /tmp/backend-ldd
CMD ["/usr/local/bin/run-container.sh"]