Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (42 loc) · 2.16 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (42 loc) · 2.16 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
# syntax=docker/dockerfile:1.7
FROM microwavedev/geesome-base AS node-base
# https://github.com/lovell/sharp/issues/3161
#RUN curl -OL https://github.com/libvips/libvips/releases/download/v8.12.2/vips-8.12.2.tar.gz && tar xf vips-8.12.2.tar.gz
#RUN cd vips-8.12.2 && ./configure && make && make install
RUN mkdir /usr/local/nvm
ENV NVM_DIR /usr/local/nvm
# https://github.com/nodejs/node/issues/46221
ENV NODE_VERSION 22.21.1
RUN curl --silent -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash
RUN \. $NVM_DIR/nvm.sh
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
WORKDIR "/geesome-node"
RUN npm i -g yarn@1.22.22
ENV YARN_CACHE_FOLDER=/usr/local/share/.cache/yarn
ENV NODE_OPTIONS=--dns-result-order=ipv4first
FROM node-base AS dependencies
COPY package.json yarn.lock .yarnrc ./
# Keep dependency installation reusable for source-only rebuilds. The Yarn v1
# cache mount preserves fetched package archives between BuildKit builds, while
# --network-concurrency 1 avoids the tar extraction race seen on small servers.
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked \
yarn -W --no-optional --frozen-lockfile --network-concurrency 1 \
&& npm rebuild youtube-dl
FROM dependencies AS frontend-build
RUN mkdir -p bash
COPY bash/publish-frontend-dist.sh bash/frontend-build-manifest.mjs ./bash/
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked \
--mount=type=cache,id=geesome-frontend-builds,target=/var/cache/geesome/frontend,sharing=locked \
GEESOME_FRONTEND_BUILD_CACHE=/var/cache/geesome/frontend \
GEESOME_FRONTEND_PUBLISH_DIR=/tmp/geesome-frontend-build \
bash bash/publish-frontend-dist.sh
FROM node-base AS runtime
ARG GEESOME_BUILD_REVISION=unknown
LABEL org.opencontainers.image.revision=$GEESOME_BUILD_REVISION
LABEL org.opencontainers.image.source="https://github.com/galtproject/geesome-node"
COPY --from=dependencies /geesome-node/node_modules ./node_modules
COPY . .
COPY --from=frontend-build /tmp/geesome-frontend-build/. /opt/geesome/frontend/
ENV STORAGE_MODULE=ipfs-http-client
ENV STORAGE_URL=http://go_ipfs:5001