diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 000000000..a40eb36ad --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,53 @@ +name: Docker Image CI + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Get twikoo:latest version + run: echo "TWIKOO_LATEST_VERSION=$(npm view twikoo@latest version)" >> "$GITHUB_ENV" + - + name: Build and push amd64 image + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: | + imaegoo/twikoo:latest + imaegoo/twikoo:${{ env.TWIKOO_LATEST_VERSION }} + - + name: Build and push arm32v7 image + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/arm/v7 + push: true + tags: | + imaegoo/twikoo:arm32v7 + imaegoo/twikoo:${{ env.TWIKOO_LATEST_VERSION }}-arm32v7 + build-args: NODE_IMAGE=arm32v7/node diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..aaa996691 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +ARG NODE_IMAGE=node +FROM ${NODE_IMAGE}:lts AS build +WORKDIR /app +ENV NODE_ENV production +RUN set -eux; \ + npm install --production tkserver@latest; \ + mkdir -p data +FROM ${NODE_IMAGE}:lts-buster-slim +WORKDIR /app +ENV NODE_ENV production +COPY --from=build /app . +EXPOSE 8080 +CMD ["/app/node_modules/.bin/tkserver"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..7e1426d6b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +# https://docs.docker.com/compose/compose-file/compose-file-v3/ +version: '3' +services: + twikoo-service: + image: imaegoo/twikoo + environment: + TWIKOO_THROTTLE: 250 + TZ: Asia/Shanghai + volumes: + - /app/data + ports: + - 8080:8080 diff --git a/docs/en/link.md b/docs/en/link.md new file mode 100644 index 000000000..17622ae08 --- /dev/null +++ b/docs/en/link.md @@ -0,0 +1 @@ +# Links