mirror of
https://github.com/stxer/explorer.git
synced 2026-01-12 08:34:27 +08:00
init repo
This commit is contained in:
45
.github/workflows/build-image.yml
vendored
Normal file
45
.github/workflows/build-image.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
name: Create and publish Docker image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
rev:
|
||||
description: 'branch or tag or commit to build'
|
||||
required: true
|
||||
default: 'main'
|
||||
tag-name:
|
||||
description: 'image tag name'
|
||||
required: true
|
||||
default: 'latest'
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
TAG_NAME: ${{ github.event.inputs.tag-name }}
|
||||
REV: ${{ github.event.inputs.rev }}
|
||||
PRE_BUILD_SCRIPT: ${{ secrets.PRE_BUILD_SCRIPT }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build ${{ github.event.inputs.tag-name }} with ${{ github.event.inputs.rev }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push Docker image
|
||||
run: |
|
||||
bash -c "$PRE_BUILD_SCRIPT"
|
||||
export IMAGE_TAG="$REGISTRY/$IMAGE_NAME:$TAG_NAME"
|
||||
echo "Building image $IMAGE_TAG"
|
||||
docker build -t $IMAGE_TAG .
|
||||
docker push $IMAGE_TAG
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
/source
|
||||
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM node:18-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./source .
|
||||
|
||||
RUN npm install -g pnpm@8.9.1
|
||||
RUN pnpm i
|
||||
RUN pnpm build
|
||||
|
||||
FROM node:18-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/next.config.js /app/next.config.js
|
||||
COPY --from=build /app/public /app/public
|
||||
COPY --from=build /app/.next/static /app/.next/static
|
||||
COPY --from=build /app/.next/standalone /app
|
||||
|
||||
CMD [ "node", "server.js" ]
|
||||
Reference in New Issue
Block a user