-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* perf: optimize docker image * perf: shrink image size * fix: build docker image * fix: docker image namespace * docs: add docker compose example * docs: fix docker compose example * docs: fix again :) * docs: and again.....
- Loading branch information
Showing
3 changed files
with
63 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: build_docker | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build_docker: | ||
name: Build docker | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: 0xjerry/chatgpt-web | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 |
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 |
---|---|---|
@@ -1,19 +1,20 @@ | ||
FROM node:lts | ||
# build front-end | ||
FROM node:lts-alpine AS builder | ||
|
||
# copy resource | ||
RUN mkdir /app | ||
COPY ./ /app | ||
WORKDIR /app | ||
|
||
# build | ||
RUN npm install pnpm -g | ||
RUN pnpm bootstrap | ||
WORKDIR /app/service | ||
RUN pnpm install | ||
RUN npm install pnpm -g && pnpm install && pnpm run build | ||
|
||
# service | ||
FROM node:lts-alpine | ||
|
||
COPY /service /app | ||
COPY --from=builder /app/dist /app/public | ||
|
||
WORKDIR /app | ||
RUN npm install pnpm -g && pnpm install | ||
|
||
EXPOSE 1002 | ||
EXPOSE 3002 | ||
|
||
CMD ["/bin/bash","./start.sh"] | ||
|
||
CMD ["pnpm", "run", "start"] |
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