Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Mon-ius committed Mar 10, 2024
0 parents commit 423fa47
Show file tree
Hide file tree
Showing 9 changed files with 505 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: build

on:
workflow_dispatch:
push:
branches:
- "main"
paths:
- "Dockerfile"
- "entrypoint.sh"
workflow_run:
workflows: ["pre-build"]
types:
- completed

jobs:
build-v1:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push BASE
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64, linux/arm64, linux/s390x, linux/ppc64le, linux/arm
tags: ${{ secrets.DOCKERHUB_USERNAME }}/docker-instant-ai
40 changes: 40 additions & 0 deletions .github/workflows/pre-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: pre-build

on:
workflow_dispatch:
schedule:
- cron: '0 6 */6 * *'
push:
branches:
- "main"
paths:
- "dev/BASE"

jobs:
base:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push BASE
uses: docker/build-push-action@v5
with:
context: .
file: ./dev/BASE
push: true
platforms: linux/amd64, linux/arm64, linux/s390x, linux/ppc64le, linux/arm
tags: ${{ secrets.DOCKERHUB_USERNAME }}/docker-instant-ai:base
25 changes: 25 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: verify

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

on:
workflow_dispatch:
workflow_run:
workflows: ["build"]
types:
- completed

jobs:
verify:
runs-on: ubuntu-latest
env:
name: ${{ github.job }}
steps:
- name: Checkout
uses: actions/checkout@v4
- run: |
docker run --name DIA -p 80:80 -p 443:443 --restart=always -itd ${{ secrets.DOCKERHUB_USERNAME }}/docker-instant-ai
- id: check
run: echo trace=$(curl -v -fsSL 127.0.0.1:80) >> $GITHUB_OUTPUT

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
.vscode/
.test/
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM monius/docker-instant-ai:base

COPY entrypoint.sh /run/entrypoint.sh
ENTRYPOINT ["/run/entrypoint.sh"]

EXPOSE 80 443

CMD ["nginx"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 AUTOM77

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# instant-ai-deploy

[![CI Status](https://github.com/AUTOM77/Docker-instant-ai/workflows/build/badge.svg)](https://github.com/AUTOM77/Docker-instant-ai/actions?query=workflow:build)
[![CI Status](https://github.com/AUTOM77/Docker-instant-ai/workflows/verify/badge.svg)](https://github.com/AUTOM77/Docker-instant-ai/actions?query=workflow:verify)
[![Docker Pulls](https://flat.badgen.net/docker/pulls/monius/docker-instant-ai)](https://hub.docker.com/r/monius/docker-instant-ai)
[![Code Size](https://img.shields.io/github/languages/code-size/AUTOM77/Docker-instant-ai)](https://github.com/AUTOM77/Docker-instant-ai)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
[![Open Issues](https://img.shields.io/github/issues/AUTOM77/Docker-instant-ai)](https://github.com/AUTOM77/Docker-instant-ai/issues)

> AI Infra on Multi-platform: `linux/amd64`, `linux/arm64`, `linux/arm`, `linux/s390x` and `linux/ppc64le`;
🚧 Building .. 🚧

Test
```sh
doas podman run --name ii -p 80:80 -p 443:443 -itd monius/docker-instant-ai
doas podman run --name ii -itd monius/docker-instant-ai
```

```bash
doas podman run --rm monius/docker-instant-ai
doas podman run --name ii -it monius/docker-instant-ai /bin/sh
doas podman run --name ii -p 80:80 -p 443:443 -it monius/docker-instant-ai /bin/sh

doas podman run -itd \
--name instant-ai \
-e DOMAIN=domain \
-e CLOUDFLARE_DNS_API_TOKEN=cf_api_token \
-e AI_SERVICE_NAME=ai_name \
-e AI_SERVICE_PORT=ai_port \
-p 80:80 \
-p 443:443 \
monius/docker-instant-ai

doas podman logs ii
doas podman inspect -f '{{.NetworkSettings.IPAddress}}' ii
doas podman rm -f $(doas podman ps -a -q)
doas podman rmi -f $(doas podman images -a -q)
```
65 changes: 65 additions & 0 deletions dev/BASE
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
FROM alpine:3.19 as NGINX

LABEL maintainer="M0nius <[email protected]>" \
alpine-version="3.19" \
nginx-version="1.25.3"

ENV XUSER="nginx"
ENV VER="1.25.3"
ENV NGINX_SRC="https://nginx.org/download/nginx-${VER}.tar.gz"
ENV PKG="build-base linux-headers openssl-dev pcre-dev curl zlib-dev"

RUN \
apk --no-cache add ${PKG} && \
curl -fsSL "${NGINX_SRC}" | tar -C /tmp -xz && \
cd /tmp/nginx-"${VER}" && \
./configure \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--user=$XUSER \
--group=$XUSER \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-file-aio \
--with-threads \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-http_slice_module \
--with-http_v2_module && \
make -j"$(nproc)" && make install

RUN curl -fsSL https://get.acme.sh | sh -s [email protected]

FROM alpine:3.19
ENV XUSER nginx

RUN apk --no-cache add ca-certificates openssl pcre zlib tzdata git

COPY --from=NGINX /usr/sbin/nginx /usr/sbin/nginx
COPY --from=NGINX /root/.acme.sh/acme.sh /root/acme.sh

# RUN du -sh / >> /etc/store.debug

RUN addgroup -S ${XUSER} && \
adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G ${XUSER} ${XUSER}

# RUN du -sh / >> /etc/store.debug
Loading

0 comments on commit 423fa47

Please sign in to comment.