Skip to content

Commit eab7011

Browse files
committed
fix: build
1 parent f80b310 commit eab7011

File tree

3 files changed

+61
-18
lines changed

3 files changed

+61
-18
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

Dockerfile

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
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 \
7-
build-base \
8-
git
5+
make \
6+
g++ \
7+
build-base
98

109
ENV PNPM_HOME="/pnpm"
1110
ENV PATH="$PNPM_HOME:$PATH"
1211
RUN corepack enable
1312

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

16-
COPY package.json ./
17-
COPY pnpm-lock.yaml ./
18+
RUN pnpm fetch --prod
1819

19-
RUN pnpm --prod install
20+
COPY . /app
2021

21-
COPY . .
22+
RUN pnpm install
2223

2324
ARG _BUILD_GIT_URL
2425
ARG _BUILD_GIT_BRANCH
@@ -32,14 +33,13 @@ ENV _BUILD_WEBSITE_VERSION=${_BUILD_WEBSITE_VERSION}
3233

3334
RUN pnpm run fetch-sources
3435

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

3838
WORKDIR /usr/src/app
3939

40-
COPY --from=build /usr/src/app .
41-
42-
RUN rm -rf /usr/src/app/node_modules/.cache
40+
COPY --from=builder /usr/src/app/node_modules /usr/src/app/node_modules
41+
COPY --from=builder /usr/src/app/index /usr/src/app/index
42+
COPY --from=builder /usr/src/app/package.json /usr/src/app/
4343

4444
ENV _APP_ASSISTANT_OPENAI_API_KEY=''
4545

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

0 commit comments

Comments
 (0)