-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* image * env * standalone * test
- Loading branch information
Showing
15 changed files
with
194 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Build xiaoyi page images in Personal warehouse | ||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- 'projects/xiaoyi/**' | ||
branches: | ||
- 'main' | ||
jobs: | ||
build-fastgpt-images: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
driver-opts: network=host | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GH_PAT }} | ||
- name: Set DOCKER_REPO_TAGGED based on branch or tag | ||
run: | | ||
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-home:xiaoyi" >> $GITHUB_ENV | ||
- name: Build and publish image for main branch or tag push event | ||
env: | ||
DOCKER_REPO_TAGGED: ${{ env.DOCKER_REPO_TAGGED }} | ||
run: | | ||
cd projects/xiaoyi && docker buildx build \ | ||
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/FastGPT" \ | ||
--label "org.opencontainers.image.description=fastgpt-home image" \ | ||
--push \ | ||
--cache-from=type=local,src=/tmp/.buildx-cache \ | ||
--cache-to=type=local,dest=/tmp/.buildx-cache \ | ||
-t ${DOCKER_REPO_TAGGED} \ | ||
-f Dockerfile \ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Install dependencies only when needed | ||
FROM node:18.15-alpine AS deps | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
RUN apk add libc6-compat && npm install -g pnpm | ||
WORKDIR /app | ||
|
||
# copy packages and one project | ||
COPY package.json pnpm-lock.yaml ./ | ||
|
||
RUN [ -f pnpm-lock.yaml ] || (echo "Lockfile not found." && exit 1) | ||
|
||
RUN pnpm install | ||
|
||
# Rebuild the source code only when needed | ||
FROM node:18.15-alpine AS builder | ||
WORKDIR /app | ||
|
||
# copy common node_modules and one project node_modules | ||
COPY . . | ||
COPY --from=deps /app/node_modules ./node_modules | ||
|
||
# Uncomment the following line in case you want to disable telemetry during the build. | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
ENV OUTPUT_MODE standalone | ||
RUN npm install -g pnpm | ||
RUN pnpm run build | ||
|
||
FROM node:18.15-alpine AS runner | ||
WORKDIR /app | ||
|
||
# create user and use it | ||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
RUN sed -i 's/https/http/' /etc/apk/repositories | ||
RUN apk add curl \ | ||
&& apk add ca-certificates \ | ||
&& update-ca-certificates | ||
|
||
# copy running files | ||
COPY --from=builder /app/public ./public | ||
COPY --from=builder /app/next.config.js ./next.config.js | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
ENV NODE_ENV production | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
ENV PORT=3000 | ||
|
||
EXPOSE 3000 | ||
|
||
USER nextjs | ||
|
||
ENV serverPath=./server.js | ||
|
||
ENTRYPOINT ["sh","-c","node ${serverPath}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React, { useRef } from 'react'; | ||
import { Box } from '@chakra-ui/react'; | ||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; | ||
|
||
import Navbar from '@/components/home/Navbar'; | ||
import Hero from '@/components/home/Hero'; | ||
import Ability from '@/components/home/Ability'; | ||
import Choice from '@/components/home/Choice'; | ||
import Footer from '@/components/home/Footer'; | ||
import { UserConfig } from 'next-i18next'; | ||
|
||
const Home = (e: { | ||
_nextI18Next?: | ||
| { | ||
initialI18nStore: any; | ||
initialLocale: string; | ||
ns: string[]; | ||
userConfig: UserConfig | null; | ||
} | ||
| undefined; | ||
beian: string; | ||
docUrl: string; | ||
statusUrl: string; | ||
cloudDomain: string; | ||
}) => { | ||
const { beian, docUrl, statusUrl, cloudDomain } = e; | ||
|
||
return ( | ||
<> | ||
<Box id="home" bg={'myWhite.600'} h={'100vh'} overflowY={'auto'} overflowX={'hidden'}> | ||
<Box position={'fixed'} zIndex={10} top={0} left={0} right={0}> | ||
<Navbar docUrl={docUrl} cloudDomain={cloudDomain} /> | ||
</Box> | ||
<Box maxW={'1200px'} pt={'70px'} m={'auto'}> | ||
<Hero cloudDomain={cloudDomain} /> | ||
<Ability /> | ||
<Box my={[4, 6]}> | ||
<Choice /> | ||
</Box> | ||
</Box> | ||
<Box bg={'white'}> | ||
<Footer beian={beian} docUrl={docUrl} statusUrl={statusUrl} cloudDomain={cloudDomain} /> | ||
</Box> | ||
</Box> | ||
</> | ||
); | ||
}; | ||
export default Home; | ||
|
||
export const getServerSideProps = async ({ locale }: any) => { | ||
return { | ||
props: { | ||
beian: process.env.BEIAN || '', | ||
docUrl: process.env.DOC_URL || '', | ||
statusUrl: process.env.STATUS_URL || '', | ||
cloudDomain: process.env.CLOUD_DOMAIN || 'https://cloud.fastgpt.in', | ||
...(await serverSideTranslations(locale)) | ||
} | ||
}; | ||
}; |