Improve Dockerfile (#9105)
* Improve Dockerfile * Update base image * Add copy layer * Delete unused RUN * Update Dockerfile Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
This commit is contained in:
parent
69087f2242
commit
9314ceae36
24
Dockerfile
24
Dockerfile
|
@ -2,23 +2,35 @@ FROM node:18.12.1-bullseye AS builder
|
||||||
|
|
||||||
ARG NODE_ENV=production
|
ARG NODE_ENV=production
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
build-essential
|
||||||
|
|
||||||
WORKDIR /misskey
|
WORKDIR /misskey
|
||||||
|
|
||||||
|
COPY [".yarnrc.yml", "package.json", "yarn.lock", "./"]
|
||||||
|
COPY [".yarn", "./.yarn"]
|
||||||
|
COPY ["scripts", "./scripts"]
|
||||||
|
COPY ["packages/backend/package.json", "./packages/backend/"]
|
||||||
|
COPY ["packages/client/package.json", "./packages/client/"]
|
||||||
|
COPY ["packages/sw/package.json", "./packages/sw/"]
|
||||||
|
|
||||||
|
RUN yarn install --immutable
|
||||||
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get install -y build-essential
|
|
||||||
RUN git submodule update --init
|
RUN git submodule update --init
|
||||||
RUN yarn install --immutable
|
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
RUN rm -rf .git
|
|
||||||
|
|
||||||
FROM node:18.12.1-bullseye-slim AS runner
|
FROM node:18.12.1-bullseye-slim AS runner
|
||||||
|
|
||||||
WORKDIR /misskey
|
WORKDIR /misskey
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update \
|
||||||
RUN apt-get install -y ffmpeg tini
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
ffmpeg tini \
|
||||||
|
&& apt-get -y clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY --from=builder /misskey/.yarn/install-state.gz ./.yarn/install-state.gz
|
COPY --from=builder /misskey/.yarn/install-state.gz ./.yarn/install-state.gz
|
||||||
COPY --from=builder /misskey/node_modules ./node_modules
|
COPY --from=builder /misskey/node_modules ./node_modules
|
||||||
|
|
Loading…
Reference in a new issue