hookshot/Dockerfile

55 lines
1.6 KiB
Docker
Raw Permalink Normal View History

2019-08-03 18:45:06 -06:00
# Stage 0: Build the thing
2021-11-21 12:52:05 +00:00
# Need debian based image to build the native rust module
# as musl doesn't support cdylib
FROM node:22-slim AS builder
# Needed in order to build rust FFI bindings.
RUN apt-get update && apt-get install -y build-essential cmake curl pkg-config pkg-config libssl-dev
2019-08-03 18:45:06 -06:00
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
2021-11-21 12:34:56 +00:00
ENV PATH="/root/.cargo/bin:${PATH}"
# arm64 builds consume a lot of memory if `CARGO_NET_GIT_FETCH_WITH_CLI` is not
# set to true, so we expose it as a build-arg.
ARG CARGO_NET_GIT_FETCH_WITH_CLI=false
ENV CARGO_NET_GIT_FETCH_WITH_CLI=$CARGO_NET_GIT_FETCH_WITH_CLI
WORKDIR /src
COPY package.json yarn.lock ./
RUN yarn config set yarn-offline-mirror /cache/yarn
RUN yarn --ignore-scripts --pure-lockfile --network-timeout 600000
COPY . ./
# Workaround: Need to install esbuild manually https://github.com/evanw/esbuild/issues/462#issuecomment-771328459
2021-11-21 13:21:58 +00:00
RUN node node_modules/esbuild/install.js
RUN yarn build
2019-08-03 18:45:06 -06:00
2019-08-03 18:45:06 -06:00
# Stage 1: The actual container
FROM node:22-slim
2019-08-03 18:45:06 -06:00
2021-11-22 16:02:07 +00:00
WORKDIR /bin/matrix-hookshot
RUN apt-get update && apt-get install -y openssl ca-certificates
COPY --from=builder /src/yarn.lock /src/package.json ./
COPY --from=builder /cache/yarn /cache/yarn
RUN yarn config set yarn-offline-mirror /cache/yarn
RUN yarn --network-timeout 600000 --production --pure-lockfile && yarn cache clean
2019-08-03 18:45:06 -06:00
COPY --from=builder /src/lib ./
COPY --from=builder /src/public ./public
COPY --from=builder /src/assets ./assets
ENV NODE_ENV="production"
2019-08-03 18:45:06 -06:00
VOLUME /data
EXPOSE 9993
EXPOSE 7775
2021-11-22 16:02:07 +00:00
CMD ["node", "/bin/matrix-hookshot/App/BridgeApp.js", "/data/config.yml", "/data/registration.yml"]