diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3bdb975..e540ce8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,7 +8,6 @@ on: - v* env: - # Use docker.io for Docker Hub if empty REGISTRY: docker.io IMAGE_NAME: ${{ github.event.repository.name }} @@ -16,36 +15,51 @@ jobs: docker: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: 0 # 获取完整的 git history 以便生成正确的 tag - - - name: Get Version + fetch-depth: 0 + + - name: Get Version id: get_version run: | echo "VERSION=$(git describe --dirty --always --tags --abbrev=7)" >> $GITHUB_OUTPUT - - - name: Login to ${{ env.REGISTRY }} + + - name: Login to ${{ env.REGISTRY }} if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{github.actor}} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up QEMU + + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx + + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Build and push + 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: Build and push uses: docker/build-push-action@v6 with: context: . + platforms: linux/amd64 push: ${{ github.event_name != 'pull_request' }} tags: | ${{ env.REGISTRY }}/${{github.actor}}/${{ github.event.repository.name }}:latest ${{ env.REGISTRY }}/${{github.actor}}/${{ github.event.repository.name }}:${{ steps.get_version.outputs.VERSION }} + cache-from: | + type=local,src=/tmp/.buildx-cache + type=registry,ref=${{ env.REGISTRY }}/${{github.actor}}/${{ github.event.repository.name }}:latest + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max \ No newline at end of file diff --git a/Gemfile b/Gemfile index bc1d147..2d351f5 100644 --- a/Gemfile +++ b/Gemfile @@ -45,7 +45,7 @@ gem "devise", "~> 4.9" gem "activeadmin", "~> 3.2" gem "friendly_id", "~> 5.5" -gem "whenever", "~> 1.0" +# gem "whenever", "~> 1.0" gem "ruby-openai", "~> 7.3" gem "httparty", "~> 0.22.0" gem "down", "~> 5.4" diff --git a/Gemfile.lock b/Gemfile.lock index 311aba6..b391945 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -126,7 +126,6 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - chronic (0.10.2) concurrent-ruby (1.3.5) connection_pool (2.5.0) crass (1.0.6) @@ -464,8 +463,6 @@ GEM base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - whenever (1.0.0) - chronic (>= 0.6.3) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.7.1) @@ -515,7 +512,6 @@ DEPENDENCIES turbo-rails tzinfo-data web-console - whenever (~> 1.0) BUNDLED WITH 2.6.2 diff --git a/config/sidekiq.yml b/config/sidekiq.yml index 808d2f1..00a443c 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -1,14 +1,5 @@ - -:concurrency: 5 -:queues: - - prod - - default - - mailers - - low - -:scheduler: - :schedule: - batch_generate_weather: - cron: '0 */2 * * *' # every 每2 hours - queue: prod - class: BatchGenerateWeatherArtsWorker +batch_generate_weather: + cron: '0 */2 * * *' + class: BatchGenerateWeatherArtsWorker + description: "Generate weather arts every 2 hours" + enabled: true