Skip to content

Commit

Permalink
Merge pull request #3 from ao-space/dev
Browse files Browse the repository at this point in the history
release v1.0.1
  • Loading branch information
yinjiayi authored Sep 21, 2023
2 parents 3fd5338 + bff38cf commit de046fb
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 11 deletions.
90 changes: 86 additions & 4 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@ on:

env:
REGISTRY: ghcr.io
EULIX_REGISTRY: ${{ secrets.EULIX_REGISTRY }}
EULIX_REGISTRY: hub.eulix.xyz
HUAWEICLOUD_REGISTRY_SH: swr.cn-east-3.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_BJ: swr.cn-north-4.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_GZ: swr.cn-south-1.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_HK: swr.ap-southeast-1.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_SG: swr.ap-southeast-3.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_AF: swr.af-south-1.myhuaweicloud.com
HUAWEICLOUD_REGISTRY_LA: swr.la-north-2.myhuaweicloud.com
IMAGE_NAME: ${{ github.repository }}

jobs:

build:
runs-on: [self-hosted, linux, x64]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
Expand All @@ -46,6 +53,9 @@ jobs:
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- run: echo "GITHUB_REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
shell: bash

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
Expand All @@ -70,17 +80,88 @@ jobs:
username: ${{ secrets.EULIX_REGISTRY_USERNAME }}
password: ${{ secrets.EULIX_REGISTRY_PASSWORD }}

- name: Log into registry Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_HUB_REGISTRY_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_SH }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_SH }}
username: cn-east-3@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_BJ }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_BJ }}
username: cn-north-4@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_GZ }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_GZ }}
username: cn-south-1@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_SG }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_SG }}
username: ap-southeast-3@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_HK }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_HK }}
username: ap-southeast-1@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_AF }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_AF }}
username: af-south-1@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_PASSWORD }}

- name: Log into registry ${{ env.HUAWEICLOUD_REGISTRY_LA }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.HUAWEICLOUD_REGISTRY_LA }}
username: la-north-2@${{ secrets.HUAWEICLOUD_USERNAME }}
password: ${{ secrets.HUAWEICLOUD_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 }}
aospace/${{ env.GITHUB_REPOSITORY_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_SH }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_BJ }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_GZ }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_HK }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_SG }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_AF }}/${{ env.IMAGE_NAME }}
${{ env.HUAWEICLOUD_REGISTRY_LA }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4.2.1
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand All @@ -90,4 +171,5 @@ jobs:
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
file: Dockerfile
file: Dockerfile
provenance: false
19 changes: 12 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@

FROM node:16.14.2 as builder

WORKDIR /work
COPY . .

RUN apt update && apt install dos2unix -y && apt clean all
RUN find . -type f -exec dos2unix {} \;

RUN npm install && npm run build && npm run buildsingle

FROM openresty/openresty:1.21.4.1-4-bullseye-fat
Expand All @@ -23,13 +28,13 @@ ENV TZ=Asia/Shanghai

RUN rm -rf /etc/nginx/conf.d
RUN mkdir -p /var/log/nginx/
COPY --from=builder nginx.conf.template /nginx.conf.template
COPY --from=builder verify_access_token.lua /etc/nginx/verify_access_token.lua
COPY --from=builder cert.crt /etc/nginx/certs/cert.pem
COPY --from=builder private.key /etc/nginx/certs/cert.key
COPY --from=builder /work/nginx.conf.template /nginx.conf.template
COPY --from=builder /work/verify_access_token.lua /etc/nginx/verify_access_token.lua
COPY --from=builder /work/cert.crt /etc/nginx/certs/cert.pem
COPY --from=builder /work/private.key /etc/nginx/certs/cert.key
RUN mkdir -p /opt/eulixspace-web/space/ /opt/eulixspace-web/share/
COPY --from=builder dist /opt/eulixspace-web/space
COPY --from=builder docker-entrypoint.sh /
COPY --from=builder /work/dist /opt/eulixspace-web/space
COPY --from=builder /work/docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
ENTRYPOINT ["/docker-entrypoint.sh"]

0 comments on commit de046fb

Please sign in to comment.