-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
2,850 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# See: https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# GitHub recommends pinning actions to a commit SHA. | ||
# To get a newer version, you will need to update the SHA. | ||
# You can also reference a tag or branch, but the action may change without warning. | ||
|
||
name: Publish Docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
push: | ||
# Sequence of patterns matched against refs/heads | ||
branches: | ||
- main | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- v0.* | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
attestations: write | ||
id-token: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: my-docker-hub-namespace/my-docker-hub-repository | ||
|
||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
file: ./Dockerfile.alpine | ||
#push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
# - name: Generate artifact attestation | ||
# uses: actions/attest-build-provenance@v1 | ||
# with: | ||
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | ||
# subject-digest: ${{ steps.push.outputs.digest }} | ||
# push-to-registry: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Use the official Node.js 23 image as base | ||
FROM node:23-bookworm | ||
|
||
USER node | ||
WORKDIR /home/node | ||
|
||
COPY package.json . | ||
COPY tsconfig.json . | ||
COPY src/ . | ||
RUN npm i | ||
|
||
ARG PORT | ||
EXPOSE ${PORT:-3000} | ||
|
||
CMD ["npm", "run", "serve"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM node:20-alpine | ||
|
||
RUN apk update && apk add python3-dev gcc libffi-dev make g++ | ||
|
||
USER node | ||
WORKDIR /home/node | ||
|
||
COPY package.json . | ||
COPY tsconfig.json . | ||
COPY src/ . | ||
RUN npm i | ||
|
||
ARG PORT | ||
EXPOSE ${PORT:-3000} | ||
|
||
CMD ["npm", "run", "serve"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# duckdb-api | ||
Running DuckDB behind a Hono.js API | ||
Running [DuckDB](https://duckdb.org/) behind a [Hono.js](https://hono.dev/) API in a Docker container. | ||
|
||
## Building the Docker image | ||
|
||
```bash | ||
docker build -t duckdb-api . | ||
``` | ||
|
||
## Usage | ||
To build and run the Docker container, use the following commands: | ||
|
||
```bash | ||
docker run -p 3000:3000 tobilg/duckdb-api:0.1.0 | ||
``` | ||
|
||
### Environment Variables | ||
The following environment variables can be set to configure the API: | ||
|
||
- `PORT`: The port to run the API on. Defaults to `3000`. (optional) | ||
- `USERNAME`: The username to be used for basic auth. (optional) | ||
- `PASSWORD`: The password to be used for basic auth. (optional) | ||
- `AWS_REGION`: The AWS region to be used for S3 access (optional) | ||
- `AWS_ACCESS_KEY_ID`: The AWS access key ID to be used for S3 access (optional) | ||
- `AWS_SECRET_ACCESS_KEY`: The AWS secret access key to be used for S3 access (optional) | ||
|
||
If you want to activate basic auth for the API, set both the `USERNAME` and the `PASSWORD` environment variables. | ||
|
||
In case you want to use AWS S3, set the `AWS_REGION`, `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables with the appropriate values (you need to have set up the appropriate credentials beforehand in your AWS account). | ||
|
||
### API Documentation | ||
The API documentation is available at the `/docs` endpoint. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", | ||
"vcs": { | ||
"enabled": false, | ||
"clientKind": "git", | ||
"useIgnoreFile": false | ||
}, | ||
"files": { | ||
"ignoreUnknown": false, | ||
"ignore": [] | ||
}, | ||
"formatter": { | ||
"enabled": true, | ||
"indentStyle": "tab", | ||
"lineWidth": 120 | ||
}, | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true | ||
} | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "single" | ||
} | ||
} | ||
} |
Oops, something went wrong.