Skip to content

Commit 9618f50

Browse files
authored
Merge pull request #29 from appwrite/fix-build
fix: build
2 parents f80b310 + 9170e89 commit 9618f50

File tree

7 files changed

+90
-45
lines changed

7 files changed

+90
-45
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Build"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v3
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Extract metadata (tags, labels) for Docker
25+
id: meta
26+
uses: docker/metadata-action@v5
27+
with:
28+
images: appwrite/assistant
29+
tags: type=sha,prefix=pr-
30+
31+
- name: Build image
32+
uses: docker/build-push-action@v5
33+
with:
34+
context: .
35+
platforms: linux/amd64,linux/arm64
36+
push: false # Don't push, just build to verify
37+
tags: ${{ steps.meta.outputs.tags }}
38+
labels: ${{ steps.meta.outputs.labels }}
39+
build-args: |
40+
_BUILD_WEBSITE_URL=https://appwrite.io
41+
_BUILD_WEBSITE_VERSION=1.6.x
42+
_BUILD_GIT_URL=https://github.com/appwrite/website.git
43+
_BUILD_GIT_BRANCH=main

.github/workflows/format.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Format"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
format:
10+
name: "Format"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: '18'
20+
21+
- name: Install dependencies
22+
run: npm install
23+
24+
- name: Format
25+
run: npm run format

.github/workflows/formatter.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/linter.yml renamed to .github/workflows/lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: "Linter"
1+
name: "Lint"
22

33
on:
44
pull_request:
55
push:
66
branches: [main]
77

88
jobs:
9-
eslint:
10-
name: "Eslint Check"
9+
lint:
10+
name: "Lint"
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout code
@@ -21,5 +21,5 @@ jobs:
2121
- name: Install dependencies
2222
run: npm install
2323

24-
- name: Run ESLint
24+
- name: Lint
2525
run: npm run lint

Dockerfile

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
# Stage 1: Build
2-
FROM node:18-alpine AS build
1+
FROM node:18-alpine AS base
32

4-
RUN apk update && apk add --no-cache \
3+
RUN apk add --no-cache \
54
python3 \
6-
py3-pip \
5+
make \
6+
g++ \
77
build-base \
88
git
99

1010
ENV PNPM_HOME="/pnpm"
1111
ENV PATH="$PNPM_HOME:$PATH"
1212
RUN corepack enable
1313

14+
FROM base AS builder
15+
16+
COPY package.json pnpm-lock.yaml /usr/src/app/
1417
WORKDIR /usr/src/app
1518

16-
COPY package.json ./
17-
COPY pnpm-lock.yaml ./
19+
RUN pnpm fetch --prod
1820

19-
RUN pnpm --prod install
21+
COPY . /usr/src/app
2022

21-
COPY . .
23+
RUN pnpm install
2224

2325
ARG _BUILD_GIT_URL
2426
ARG _BUILD_GIT_BRANCH
@@ -32,14 +34,14 @@ ENV _BUILD_WEBSITE_VERSION=${_BUILD_WEBSITE_VERSION}
3234

3335
RUN pnpm run fetch-sources
3436

35-
# Stage 2: Runtime
36-
FROM node:18-alpine AS runtime
37+
FROM base
3738

3839
WORKDIR /usr/src/app
3940

40-
COPY --from=build /usr/src/app .
41-
42-
RUN rm -rf /usr/src/app/node_modules/.cache
41+
COPY --from=builder /usr/src/app/node_modules /usr/src/app/node_modules
42+
COPY --from=builder /usr/src/app/sources /usr/src/app/sources
43+
COPY --from=builder /usr/src/app/package.json /usr/src/app/
44+
COPY --from=builder /usr/src/app/src /usr/src/app/src
4345

4446
ENV _APP_ASSISTANT_OPENAI_API_KEY=''
4547

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ If you want to pull from a different branch or repository, you can set the `_BUI
3030

3131
First, retrieve an API key from OpenAI. You can sign up for an API key at [OpenAI](https://beta.openai.com/signup/). Once you have an API key, set it as the `_APP_ASSISTANT_OPENAI_API_KEY` environment variable.
3232

33-
To run the server, execute the `dev` command. By default, the server will be available at `http://localhost:3000`
33+
To run the server, execute the `dev` command. By default, the server will be available at `http://localhost:3003`
3434

3535
```bash
3636
pnpm run dev
@@ -41,7 +41,7 @@ The server exposes a POST endpoint at `/`. The endpoint expects a raw text body
4141
Use cURL to test the server, for example:
4242

4343
```bash
44-
curl -X POST -H "Content-Type: application/json" -d "{\"prompt\": \"How do I create a new user?\"}" http://localhost:3000/v1/models/assistant/prompt
44+
curl -X POST -H "Content-Type: application/json" -d "{\"prompt\": \"How do I create a new user?\"}" http://localhost:3003/v1/models/assistant/prompt
4545
```
4646

4747
## Contributing

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ services:
44
ports:
55
- 3003:3003
66
volumes:
7-
- ./docs:/app/docs
7+
- ./sources:/usr/src/app/sources
88
environment:
99
- _APP_ASSISTANT_OPENAI_API_KEY

0 commit comments

Comments
 (0)