mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-26 22:34:02 +08:00
feat: publish docker image
This commit is contained in:
parent
5e7afbf2b4
commit
7d5b3cddcc
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
42
.github/workflows/release.yml
vendored
42
.github/workflows/release.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
release-type: node
|
||||
|
||||
release:
|
||||
release-assets:
|
||||
needs: release-please
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
@ -45,13 +45,13 @@ jobs:
|
||||
- name: build for gh-pages
|
||||
run: pnpm build --base /metacubexd
|
||||
|
||||
- name: publish github pages
|
||||
- name: publish gh-pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./dist
|
||||
|
||||
- name: build for release
|
||||
- name: build for github release
|
||||
run: pnpm build
|
||||
|
||||
- name: zip
|
||||
@ -59,8 +59,42 @@ jobs:
|
||||
zip -r ../dist.zip .
|
||||
working-directory: dist
|
||||
|
||||
- name: attach release artifacts
|
||||
- name: attach github release artifacts
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: dist.zip
|
||||
tag_name: ${{ needs.release-please.outputs.tag_name }}
|
||||
|
||||
release-image:
|
||||
needs: release-please
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
steps:
|
||||
- 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
|
||||
id: buildx
|
||||
|
||||
- name: login to ghrc.io
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: build and publish ghcr.io docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
file: Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
7
Caddyfile
Normal file
7
Caddyfile
Normal file
@ -0,0 +1,7 @@
|
||||
:80 {
|
||||
file_server
|
||||
|
||||
root * .
|
||||
|
||||
try_files {path} /index.html
|
||||
}
|
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
FROM docker.io/node:alpine as builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN corepack enable
|
||||
RUN corepack prepare pnpm@latest --activate
|
||||
RUN pnpm install
|
||||
RUN pnpm build
|
||||
|
||||
FROM docker.io/caddy:alpine
|
||||
|
||||
WORKDIR /srv
|
||||
|
||||
COPY --from=builder /build/dist/. .
|
||||
COPY Caddyfile .
|
||||
|
||||
CMD ["caddy", "run"]
|
Loading…
Reference in New Issue
Block a user