-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
100 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,44 @@ | ||
name: docker-push | ||
|
||
on: | ||
workflow_dispatch: | ||
# 暂时取消自动编译,优化后重新开启 | ||
# push: | ||
# tags: | ||
# - 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Clone Frontend Project | ||
run: git clone https://github.com/li-calendar-notepad/li-calendar-vue.git web | ||
|
||
- name: Read version from file | ||
id: read_version | ||
# run: echo "APP_VERSION=$(cut -d '|' -f 2 ./assets/version)" >> $GITHUB_ENV // 暂时不支持括号 | ||
run: echo "APP_VERSION=latest" >> $GITHUB_ENV | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . # 这里在项目根目录找Dockerfile构建 | ||
# platforms: linux/amd64 | ||
platforms: linux/amd64,linux/arm,linux/arm64 | ||
push: true | ||
tags: ${{ vars.DOCKER_IMAGE_NAME }}:${{ env.APP_VERSION }},${{ vars.DOCKER_IMAGE_NAME }} |
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,4 +1,8 @@ | ||
FROM node:16.17.1-alpine3.15 as web_image | ||
FROM node AS web_image | ||
|
||
# 华为源 | ||
# RUN npm config set registry https://repo.huaweicloud.com/repository/npm/ | ||
|
||
|
||
WORKDIR /build | ||
|
||
|
@@ -9,30 +13,41 @@ RUN npm install \ | |
|
||
|
||
|
||
FROM golang:1.19 as server_image | ||
FROM golang:1.21-alpine3.18 as server_image | ||
|
||
WORKDIR /build | ||
|
||
COPY . . | ||
|
||
COPY --from=web_image /build/dist /build/assets/frontend | ||
|
||
# 执行指令 关闭链接确认 | ||
# 中国国内源 | ||
# RUN sed -i "[email protected]@mirrors.aliyun.com@g" /etc/apk/repositories \ | ||
# && go env -w GOPROXY=https://goproxy.cn,direct | ||
|
||
RUN apk add --no-cache bash curl gcc git musl-dev | ||
|
||
RUN go env -w GO111MODULE=on \ | ||
&& go env -w GOPROXY=https://goproxy.cn,direct \ | ||
&& export PATH=$PATH:/go/bin \ | ||
&& go install -a -v github.com/go-bindata/go-bindata/...@latest \ | ||
&& go install -a -v github.com/elazarl/go-bindata-assetfs/...@latest \ | ||
&& go-bindata-assetfs -o=assets/bindata.go -pkg=assets assets/... \ | ||
&& go mod tidy \ | ||
&& go build -o li-calendar --ldflags="-X main.RunMode=release -X main.IsDocker=docker" main.go | ||
|
||
|
||
FROM ubuntu | ||
FROM alpine | ||
|
||
# 中国国内源 | ||
# RUN sed -i "[email protected]@mirrors.aliyun.com@g" /etc/apk/repositories | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=server_image /build/li-calendar /app/li-calendar | ||
|
||
RUN apt-get update && apt-get install -y ca-certificates &&./li-calendar config | ||
EXPOSE 9090 | ||
|
||
RUN apk add --no-cache bash ca-certificates su-exec tzdata \ | ||
&& chmod +x ./li-calendar | ||
|
||
CMD ./li-calendar |
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 +1 @@ | ||
1|0.1.2(beta) | ||
1|0.1.2-beta |
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,14 @@ | ||
version: "3.2" | ||
|
||
services: | ||
sun-panel: | ||
image: 'licalendar:latest' | ||
container_name: licalendar | ||
volumes: | ||
- ./conf:/app/conf | ||
- ./uploads:/app/uploads | ||
- ./database:/app/database | ||
# - ./runtime:/app/runtime | ||
ports: | ||
- 9090:9090 | ||
restart: always |
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