Skip to content

Commit

Permalink
fix(server): fix prisma bin engine error in amd64 (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow authored Dec 15, 2022
1 parent 3282894 commit 4c76333
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 69 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/dockerize-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ jobs:
with:
fetch-depth: 0

- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 18.x
# - name: Use Node
# uses: actions/setup-node@v3
# with:
# node-version: 18.x

- name: Install Package
working-directory: server
run: npm cache clean --force && npm install
# - name: Install Package
# working-directory: server
# run: npm cache clean --force && npm install

- name: Build Server
working-directory: server
run: npm run build
# - name: Build Server
# working-directory: server
# run: npm run build

- name: Docker meta
id: meta
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"sealctl",
"sealos",
"signin",
"statefulset",
"storageclass",
"tolerations",
"uids",
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/database/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ WORKDIR /

USER 65532:65532

COPy bin/manager-$TARGETARCH /manager
COPY bin/manager-$TARGETARCH /manager

ENTRYPOINT ["/manager"]
2 changes: 1 addition & 1 deletion core/controllers/gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ WORKDIR /

USER 65532:65532

COPy bin/manager-$TARGETARCH /manager
COPY bin/manager-$TARGETARCH /manager

ENTRYPOINT ["/manager"]
2 changes: 1 addition & 1 deletion core/controllers/oss/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ WORKDIR /

USER 65532:65532

COPy bin/manager-$TARGETARCH /manager
COPY bin/manager-$TARGETARCH /manager

ENTRYPOINT ["/manager"]
3 changes: 2 additions & 1 deletion server/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# node_modules
dist
node_modules
.env.local
.env
7 changes: 4 additions & 3 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ FROM node:18-slim
RUN apt-get update
RUN apt-get install -y openssl

ARG TARGETARCH

WORKDIR /app

EXPOSE 3000

COPY . /app

# RUN npm install
# RUN npx prisma generate
# RUN npm run build
RUN npm install
RUN npm run build

CMD [ "node", "dist/main" ]
8 changes: 4 additions & 4 deletions server/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# @see https://github.com/prisma/prisma/issues/8478#issuecomment-1095544159
FROM positivly/prisma-binaries:latest as prisma

FROM node:18-alpine
RUN apk add --no-cache openssl
FROM node:18-slim

RUN apt-get update
RUN apt-get install -y openssl

## Your normal build steps here

Expand All @@ -18,10 +20,8 @@ COPY --from=prisma /prisma-engines/query-engine /prisma-engines/migration-engine

EXPOSE 3000
WORKDIR /app
ENV LOG_LEVEL=debug
COPY . /app
RUN npm install
RUN npx prisma generate --schema ./prisma/schema.prisma
RUN npm run build
USER node
CMD [ "node", "dist/main" ]
65 changes: 18 additions & 47 deletions server/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
</p>

[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest

<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->

## Description

Expand All @@ -29,20 +7,27 @@
## Installation

```bash
$ npm install
npm install
npx prisma generate
npx prisma db push
```

## Running the app
## Debug the app

```bash
# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod
# Forward service in cluster to localhost, run this command in another terminal separately
kubectl port-forward deployment/mongodb 27017:27017 -n laf-system
kubectl port-forward statefulset/laf-minio 9000:9000 -n laf-system
kubectl port-forward deployments/casdoor 30070:8000 -n laf-system

# Run these in first time or when someone change the schema.
cd server
npm install
npx prisma db push
npx prisma generate

# run dev
npm run watch
```

## Test
Expand All @@ -56,18 +41,4 @@ $ npm run test:e2e

# test coverage
$ npm run test:cov
```

## Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).

## Stay in touch

- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)

## License

Nest is [MIT licensed](LICENSE).
```
3 changes: 2 additions & 1 deletion server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
generator client {
provider = "prisma-client-js"
// previewFeatures = ["interactiveTransactions"]
binaryTargets = ["native", "linux-arm64-openssl-1.1.x"]
// binaryTargets = ["native", "linux-arm64-openssl-1.1.x"]
binaryTargets = ["native"]
}

datasource db {
Expand Down

0 comments on commit 4c76333

Please sign in to comment.