hookshot/Dockerfile
Will Hunt 10e4e88431
Remove --no-script from yarn (#448)
* Remove --no-script from yarn

As it turns out, we need to run the script to build the all important
crypto modules that we don't use. The --no-script is intended to avoid
us trying to build the project, but in practise I think this does more
harm than good (we don't seem to build when the production flag is used)

* changelog
2022-08-22 10:52:48 +01:00

44 lines
1.3 KiB
Docker

# Stage 0: Build the thing
# Need debian based image to build the native rust module
# as musl doesn't support cdylib
FROM node:16 AS builder
# We need rustup so we have a sensible rust version, the version packed with bullsye is too old
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
ENV PATH="/root/.cargo/bin:${PATH}"
# Needed to build rust things for matrix-sdk-crypto-nodejs
# See https://github.com/matrix-org/matrix-rust-sdk-bindings/blob/main/crates/matrix-sdk-crypto-nodejs/release/Dockerfile.linux#L5-L6
RUN apt-get update && apt-get install -y build-essential cmake
WORKDIR /src
COPY package.json yarn.lock ./
RUN yarn --ignore-scripts --pure-lockfile
COPY . ./
# Workaround: Need to install esbuild manually https://github.com/evanw/esbuild/issues/462#issuecomment-771328459
RUN node node_modules/esbuild/install.js
RUN yarn build
# Stage 1: The actual container
FROM node:16-slim
WORKDIR /bin/matrix-hookshot
COPY --from=builder /src/yarn.lock /src/package.json ./
RUN yarn --production --pure-lockfile && yarn cache clean
COPY --from=builder /src/lib ./
COPY --from=builder /src/public ./public
VOLUME /data
EXPOSE 9993
EXPOSE 7775
CMD ["node", "/bin/matrix-hookshot/App/BridgeApp.js", "/data/config.yml", "/data/registration.yml"]