Skip to content

Commit a9f9bee

Browse files
authored
Merge pull request #2 from appwrite/feat-dockerize
Dockerize
2 parents 1a80d4a + 70e8270 commit a9f9bee

5 files changed

Lines changed: 68 additions & 78 deletions

File tree

.github/workflows/deploy.yml

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

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "Release"
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
tests:
9+
name: Release
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
with:
16+
# We must fetch at least the immediate parents so that if this is
17+
# a pull request then we can checkout the head.
18+
fetch-depth: 2
19+
# Fetch submodules
20+
submodules: recursive
21+
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v2
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v2
27+
28+
- name: Login to Docker Hub
29+
uses: docker/login-action@v2
30+
with:
31+
username: ${{ secrets.DOCKERHUB_USERNAME }}
32+
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
34+
- name: Extract metadata (tags, labels) for Docker
35+
id: meta
36+
uses: docker/metadata-action@v4
37+
with:
38+
images: appwrite/appwrite
39+
tags: |
40+
type=semver,pattern={{major}}.{{minor}}.{{patch}}
41+
type=semver,pattern={{major}}.{{minor}}
42+
type=semver,pattern={{major}}
43+
44+
- name: Build and push
45+
uses: docker/build-push-action@v4
46+
with:
47+
context: .
48+
platforms: linux/amd64,linux/arm64
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
FROM python:3.9
1+
FROM node:18
22

3-
WORKDIR /app
3+
WORKDIR /usr/src/app
44

5-
COPY requirements.txt ./
6-
RUN pip install --no-cache-dir -r requirements.txt
5+
COPY package.json ./
6+
COPY pnpm-lock.yaml ./
7+
8+
RUN npm install -g pnpm
9+
10+
RUN pnpm --prod install
711

812
COPY . .
913

10-
CMD [ "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80" ]
14+
ENV OPENAI_API_KEY='' \
15+
ASSISTANT_SECRET=''
16+
17+
EXPOSE 3003
18+
CMD [ "node", "main.js" ]

docker-compose.yml

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,12 @@
11
version: '3.8'
22

33
services:
4-
traefik:
5-
image: traefik:v2.10
6-
command:
7-
- --log.level=DEBUG
8-
- --api.insecure=true
9-
- --providers.docker=true
10-
- --providers.docker.exposedByDefault=false
11-
- --entrypoints.web.address=:80
12-
- --entrypoints.websecure.address=:443
13-
- --accesslog=true
14-
ports:
15-
- 80:80
16-
- 8080:8080
17-
volumes:
18-
- "/var/run/docker.sock:/var/run/docker.sock"
19-
networks:
20-
- gateway
21-
224
assistant:
235
build: .
24-
networks:
25-
- gateway
26-
labels:
27-
- "traefik.enable=true"
28-
- "traefik.http.services.assistant-service.loadbalancer.server.port=80"
29-
# http
30-
- "traefik.http.routers.assistant.entrypoints=web"
31-
- "traefik.http.routers.assistant.rule=PathPrefix(`/`)"
32-
- "traefik.http.routers.assistant.service=assistant-service"
6+
ports:
7+
- 3003:3003
338
volumes:
349
- ./docs:/app/docs
3510
environment:
3611
- OPENAI_API_KEY
37-
38-
networks:
39-
gateway:
40-
driver: bridge
12+
- ASSISTANT_SECRET

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ai-api",
3-
"version": "1.0.0",
3+
"version": "0.1.0",
44
"description": "",
55
"main": "main.js",
66
"scripts": {

0 commit comments

Comments
 (0)