Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add build docker image #74

Merged
merged 1 commit into from
May 1, 2024
Merged

Conversation

rookie-luochao
Copy link
Contributor

@rookie-luochao rookie-luochao commented May 1, 2024

构建docker镜像,方便docker容器化部署项目

补充:

  1. docker镜像推到github container hub
  2. 获取github token,最好选择Generate new token (classic),把权限都够选上,设置token不过期,设置链接参考链接
  3. 给当前项目配置github token,因为镜像工作流 ci 文件需要使用它(在项目Actions secrets and variables栏目:新建 GHCR_TOKEN 键,把github token赋值给它),参考链接:https://docs.github.com/zh/actions/security-guides/automatic-token-authentication
  4. docker 镜像一般都需要版本号,所以触发工作流的时机为打 tag 触发 docker 镜像构建

Copy link

vercel bot commented May 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
douyin ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 1, 2024 2:17am

@zyronon zyronon changed the base branch from master to dev May 1, 2024 05:20
@zyronon
Copy link
Owner

zyronon commented May 1, 2024

好的好的,万分感谢,我先合到dev哈,我研究一下怎么弄

@zyronon zyronon merged commit e98aac5 into zyronon:dev May 1, 2024
1 check passed
@zyronon
Copy link
Owner

zyronon commented May 2, 2024

弄好了,vite有个bug,我从下午搞到半夜....

# pull Docker image
docker pull ghcr.io/zyronon/douyin-vue:latest

# start container, nginx reverse proxy custom port, for example: docker run -d -p 80:80 ghcr.io/zyronon/douyin-vue:latest
docker run -d -p 80:80 ghcr.io/zyronon/douyin-vue:latest

@rookie-luochao
Copy link
Contributor Author

弄好了,vite有个bug,我从下午搞到半夜....

# pull Docker image
docker pull ghcr.io/zyronon/douyin-vue:latest

# start container, nginx reverse proxy custom port, for example: docker run -d -p 80:80 ghcr.io/zyronon/douyin-vue:latest
docker run -d -p 80:80 ghcr.io/zyronon/douyin-vue:latest

官方已经修复了吗,我也发现本地能build过,容器里面经常因为环境问题build失败,所以我都经常用Makefile执行保证本地至少能跑出镜像

@zyronon
Copy link
Owner

zyronon commented May 2, 2024

你也是这个问题吗?vitejs/vite#16572

我给vite提了个issue,但他说不是他们的问题

我这也是本地build没问题,github action里面会失败,结果发现是vite 的配置文件导致的

@rookie-luochao
Copy link
Contributor Author

你也是这个问题吗?vitejs/vite#16572

我给vite提了个issue,但他说不是他们的问题

我这也是本地build没问题,github action里面会失败,结果发现是vite 的配置文件导致的

我不是哈,但是我会遇到其他的问题,遇到过说少npm包的问题,但是本地也是没问题的,最后强行加依赖包,我本地dev, build都没有报少包,所以很多人锁包版本也是正常的

@rookie-luochao
Copy link
Contributor Author

你也是这个问题吗?vitejs/vite#16572

我给vite提了个issue,但他说不是他们的问题

我这也是本地build没问题,github action里面会失败,结果发现是vite 的配置文件导致的

也遇到过本地用最新pnpm没问题,在容器里面用最新的pnpm却报错,反正我遇到过很多了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants