Skip to content

Commit

Permalink
[Fix]: include prisma query engine to docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Istiopaxx committed Nov 23, 2023
1 parent 74b7e5e commit 7919d9e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ FROM node:20-slim
WORKDIR /app

RUN npm install [email protected] -g
RUN apt-get update -y && apt-get install -y openssl

COPY ./ecosystem.config.js .

COPY ./dist/apps/api-bundled/image-process.proto .
COPY ./dist/apps/api-bundled/main.js .
COPY ./dist/apps/api-bundled/.prisma/client/* ./node_modules/.prisma/client/
COPY ./prisma/schema.prisma ./prisma/schema.prisma

EXPOSE 8080

Expand Down
3 changes: 2 additions & 1 deletion api/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
generator client {
provider = "prisma-client-js"
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-arm64-openssl-3.0.x"]
}

datasource mysql {
Expand Down
13 changes: 13 additions & 0 deletions api/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const TerserPlugin = require('terser-webpack-plugin');
const CopyWebpackPlugin = require("copy-webpack-plugin");

module.exports = (options, webpack) => {
const lazyImports = [
Expand Down Expand Up @@ -36,6 +37,18 @@ module.exports = (options, webpack) => {
},
plugins: [
...options.plugins,
new CopyWebpackPlugin({
patterns: [
{
from: `./node_modules/.prisma/client/libquery*.node`,
to({ context, absoluteFilename }) {
return `./apps/api-bundled/.prisma/client/${absoluteFilename
.split('/')
.pop()}`;
},
},
],
}),
new webpack.IgnorePlugin({
checkResource(resource) {
if (lazyImports.includes(resource)) {
Expand Down

0 comments on commit 7919d9e

Please sign in to comment.