Skip to content

Commit

Permalink
First commit for open source
Browse files Browse the repository at this point in the history
  • Loading branch information
yinjiayi committed Sep 5, 2023
0 parents commit ee9d091
Show file tree
Hide file tree
Showing 6 changed files with 932 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: container build and push

on:
push:
branches: [ "*" ]
tags: [ '*.*.*' ]
pull_request:
branches: [ "*" ]

env:
REGISTRY: ghcr.io
EULIX_REGISTRY: ${{ secrets.EULIX_REGISTRY }}
IMAGE_NAME: ${{ github.repository }}

jobs:

build:
runs-on: [self-hosted, linux, x64]
permissions:
contents: read
packages: write
id-token: write

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log into registry ${{ env.EULIX_REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.EULIX_REGISTRY }}
username: ${{ secrets.EULIX_REGISTRY_USERNAME }}
password: ${{ secrets.EULIX_REGISTRY_PASSWORD }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v2
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.EULIX_REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
file: Dockerfile
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM alpine:3.12.0 AS base_image

FROM base_image AS build

RUN apk add --no-cache curl build-base openssl openssl-dev zlib-dev linux-headers pcre-dev git
RUN mkdir nginx

RUN git clone https://github.com/ao-space/nginx-vod-module.git

ARG NGINX_VERSION=1.23.0
ARG VOD_MODULE_VERSION=d96b61febe06f147f937dde721921f2d2206c6bc

RUN curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -C /nginx --strip 1 -xz

WORKDIR /nginx
RUN ./configure --prefix=/usr/local/nginx \
--add-module=../nginx-vod-module \
--with-http_ssl_module \
--with-file-aio \
--with-threads \
--with-cc-opt="-O3"
RUN make
RUN make install
RUN rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default

FROM base_image
RUN apk add --no-cache ca-certificates openssl pcre zlib
COPY --from=build /usr/local/nginx /usr/local/nginx
COPY nginx.conf /usr/local/nginx/conf/nginx.conf
ENTRYPOINT ["/usr/local/nginx/sbin/nginx"]
CMD ["-g", "daemon off;"]
Loading

0 comments on commit ee9d091

Please sign in to comment.