2021-11-11 20:10:58 +00:00
|
|
|
# Build the git includes for the docs
|
2021-10-26 11:30:57 +00:00
|
|
|
FROM alpine:3 as docs_include
|
2022-09-14 17:19:53 +00:00
|
|
|
RUN apk add --no-cache git bash curl
|
2021-10-26 11:30:57 +00:00
|
|
|
WORKDIR /app
|
|
|
|
COPY lemmy-docs ./lemmy-docs
|
|
|
|
WORKDIR /app/lemmy-docs
|
|
|
|
RUN ./update-includes.sh
|
|
|
|
|
2021-03-15 17:18:03 +00:00
|
|
|
# Build the docs
|
2023-06-21 11:13:54 +00:00
|
|
|
FROM alpine:3 as docs
|
2021-03-15 17:18:03 +00:00
|
|
|
WORKDIR /app
|
2023-06-21 11:13:54 +00:00
|
|
|
RUN wget -O mdbook.tar.gz https://github.com/rust-lang/mdBook/releases/download/v0.4.30/mdbook-v0.4.30-x86_64-unknown-linux-musl.tar.gz
|
|
|
|
RUN tar -xzf mdbook.tar.gz
|
2021-03-15 17:18:03 +00:00
|
|
|
COPY lemmy-docs ./lemmy-docs
|
2023-06-21 11:13:54 +00:00
|
|
|
RUN ./mdbook build lemmy-docs -d ../docs
|
2021-03-15 17:18:03 +00:00
|
|
|
|
2021-08-23 14:58:01 +00:00
|
|
|
# Build the typedoc API docs
|
2023-06-22 14:39:48 +00:00
|
|
|
FROM node:alpine as api
|
2021-03-15 17:18:03 +00:00
|
|
|
WORKDIR /app
|
2021-08-23 14:58:01 +00:00
|
|
|
COPY lemmy-js-client lemmy-js-client
|
|
|
|
WORKDIR /app/lemmy-js-client
|
2024-01-29 10:38:14 +00:00
|
|
|
RUN corepack enable pnpm
|
|
|
|
RUN pnpm i
|
|
|
|
RUN pnpm run docs
|
2021-03-15 17:18:03 +00:00
|
|
|
|
|
|
|
# Build the isomorphic app
|
2023-06-22 14:39:48 +00:00
|
|
|
FROM node:alpine as builder
|
2024-01-29 10:38:14 +00:00
|
|
|
RUN apk update && apk add python3 build-base gcc wget git curl --no-cache
|
2023-10-31 13:31:03 +00:00
|
|
|
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
|
2024-01-29 10:38:14 +00:00
|
|
|
RUN corepack enable pnpm
|
2021-03-15 17:18:03 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Cache deps
|
2024-01-29 10:38:14 +00:00
|
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
RUN pnpm i
|
2021-03-15 17:18:03 +00:00
|
|
|
|
|
|
|
# Build
|
|
|
|
COPY tsconfig.json \
|
|
|
|
webpack.config.js \
|
|
|
|
.babelrc \
|
2022-03-07 15:44:45 +00:00
|
|
|
generate_translations.mjs \
|
2023-12-18 22:24:33 +00:00
|
|
|
generate_rss_feed.mjs \
|
2023-10-31 13:31:03 +00:00
|
|
|
tailwind.config.js \
|
2021-03-15 17:18:03 +00:00
|
|
|
./
|
|
|
|
|
2021-03-23 16:37:49 +00:00
|
|
|
COPY joinlemmy-translations joinlemmy-translations
|
2021-03-31 19:23:58 +00:00
|
|
|
COPY lemmy-translations lemmy-translations
|
2021-03-15 17:18:03 +00:00
|
|
|
COPY src src
|
|
|
|
|
|
|
|
# Copy the docs and API
|
|
|
|
COPY --from=docs /app/docs ./src/assets/docs
|
2021-08-23 14:58:01 +00:00
|
|
|
COPY --from=api /app/lemmy-js-client/docs ./src/assets/api
|
2021-03-15 17:18:03 +00:00
|
|
|
|
2024-01-29 10:38:14 +00:00
|
|
|
RUN pnpm i
|
|
|
|
RUN pnpm prebuild:prod
|
|
|
|
RUN pnpm build:prod
|
2021-03-15 17:18:03 +00:00
|
|
|
|
2023-10-31 13:31:03 +00:00
|
|
|
# Prune the image
|
|
|
|
RUN node-prune ./node_modules
|
|
|
|
|
|
|
|
RUN rm -rf ./node_modules/import-sort-parser-typescript
|
|
|
|
RUN rm -rf ./node_modules/typescript
|
|
|
|
RUN rm -rf ./node_modules/npm
|
|
|
|
|
2023-06-22 14:39:48 +00:00
|
|
|
FROM node:alpine as runner
|
2021-03-15 17:18:03 +00:00
|
|
|
COPY --from=builder /app/dist /app/dist
|
|
|
|
COPY --from=builder /app/node_modules /app/node_modules
|
|
|
|
|
|
|
|
EXPOSE 1234
|
|
|
|
WORKDIR /app
|
|
|
|
CMD node dist/js/server.js
|