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
|
|
|
|
RUN yarn
|
|
|
|
RUN yarn 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
|
2021-03-15 17:18:03 +00:00
|
|
|
RUN apk update && apk add yarn python3 build-base gcc wget git --no-cache
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Cache deps
|
|
|
|
COPY package.json yarn.lock ./
|
|
|
|
RUN yarn install --pure-lockfile
|
|
|
|
|
|
|
|
# Build
|
|
|
|
COPY tsconfig.json \
|
|
|
|
webpack.config.js \
|
|
|
|
.babelrc \
|
2022-03-07 15:44:45 +00:00
|
|
|
generate_translations.mjs \
|
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
|
|
|
|
2023-06-29 13:39:01 +00:00
|
|
|
RUN yarn install --pure-lockfile
|
|
|
|
RUN yarn build:prod
|
2021-03-15 17:18:03 +00:00
|
|
|
|
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
|