forked from clansty/Q2TG
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
74 lines (63 loc) · 2.88 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
# syntax=docker/dockerfile:labs
FROM node:18-slim AS base
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && apt-get --no-install-recommends install -y \
fonts-wqy-microhei \
libpixman-1-0 libcairo2 libpango1.0-0 libgif7 libjpeg62-turbo libpng16-16 librsvg2-2 libvips42 ffmpeg librlottie0-1
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
FROM base AS build
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && apt-get --no-install-recommends install -y \
python3 build-essential pkg-config \
libpixman-1-dev libcairo2-dev libpango1.0-dev libgif-dev libjpeg62-turbo-dev libpng-dev librsvg2-dev libvips-dev
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml /app/
COPY patches /app/patches
COPY main/package.json /app/main/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store,sharing=locked \
--mount=type=secret,id=npmrc,target=/root/.npmrc \
pnpm install --frozen-lockfile
COPY main/src main/tsconfig.json /app/main/
COPY main/prisma /app/main/
RUN cd main && pnpm exec prisma generate
RUN cd main && pnpm run build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store,sharing=locked \
--mount=type=secret,id=npmrc,target=/root/.npmrc \
pnpm deploy --filter=q2tg-main --prod deploy
FROM debian:bookworm-slim AS tgs-to-gif-build
ADD https://github.com/conan-io/conan/releases/download/1.61.0/conan-ubuntu-64.deb /tmp/conan.deb
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && apt-get --no-install-recommends install -y \
python3 build-essential pkg-config cmake librlottie-dev zlib1g-dev /tmp/conan.deb
ADD https://github.com/ed-asriyan/lottie-converter.git#f626548ced4492235b535552e2449be004a3a435 /app
WORKDIR /app
RUN sed -i 's@zlib/1.2.11@@g' conanfile.txt
RUN conan install .
RUN sed -i 's/\${CONAN_LIBS}/z/g' CMakeLists.txt
RUN cmake CMakeLists.txt && make
FROM base AS build-front
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml /app/
COPY patches /app/patches
COPY ui/package.json /app/ui/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store,sharing=locked pnpm install --frozen-lockfile
COPY ui/index.html ui/tsconfig.json ui/vite.config.ts /app/ui/
COPY ui/src /app/ui/src
RUN cd ui && pnpm run build
FROM base
COPY --from=tgs-to-gif-build /app/bin/tgs_to_gif /usr/local/bin/tgs_to_gif
ENV TGS_TO_GIF=/usr/local/bin/tgs_to_gif
COPY main/assets /app/assets
COPY --from=build /app/deploy /app
COPY main/prisma /app/
RUN pnpm exec prisma generate
COPY --from=build-front /app/ui/dist /app/front
ENV UI_PATH=/app/front
ENV DATA_DIR=/app/data
EXPOSE 8080
CMD pnpm start