Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# project
config/*.local.yml
config/*.p8
main.rb
Makefile
stores

# docker
Dockerfile*

# common
README.*
.git*
.gitignore
.editorconfig
.rubocop.yml
.ruby-gemset
.ruby-version
.rvmrc
.byebug_history
.history
.bundle
.vscode
.DS_Store
.ruby-gemset
.ruby-version
.codeclimate.yml
47 changes: 47 additions & 0 deletions .github/workflows/publish_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Nightly Docker Image
on:
push:
paths-ignore:
- '.github/*.yml'
- '*.md'
- '*.yml'
- '.rubocop.yml'
- 'Rakefile'
- 'LICENSE'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: build gem
run: |
bundle install
bundle exec rake build
- name: Get gem version
id: gem_version
run: echo "::set-output name=value::$(bundle exec rake gem_version)"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Github Registry
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
build-args: |
REPLACE_CHINA_MIRROR=false
APP_STATUS_NOTIFICATION_VERSION=${{ steps.gem_version.outputs.value }}
tags: icyleaf/app_status_notification:nightly
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ruby:2.7-alpine

ARG REPLACE_CHINA_MIRROR="true"
ARG ORIGINAL_REPO_URL="http://dl-cdn.alpinelinux.org"
ARG MIRROR_REPO_URL="https://mirrors.tuna.tsinghua.edu.cn"
ARG RUBYGEMS_SOURCE="https://gems.ruby-china.com/"
ARG TZ="Asia/Shanghai"
ARG APP_STATUS_NOTIFICATION_VERSION="app_status_notification-0.9.0.beta6"

# System dependencies
RUN set -ex && \
if [[ "$REPLACE_CHINA_MIRROR" == "true" ]]; then \
REPLACE_STRING=$(echo $MIRROR_REPO_URL | sed 's/\//\\\//g') && \
SEARCH_STRING=$(echo $ORIGINAL_REPO_URL | sed 's/\//\\\//g') && \
sed -i "s/$SEARCH_STRING/$REPLACE_STRING/g" /etc/apk/repositories && \
gem sources --add $RUBYGEMS_SOURCE --remove https://rubygems.org/; \
fi && \
apk --update --no-cache add tzdata && \
cp /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone

COPY pkg/${APP_STATUS_NOTIFICATION_VERSION}.gem /tmp/
RUN gem install /tmp/${APP_STATUS_NOTIFICATION_VERSION}.gem

WORKDIR /app

VOLUME [ "/app/config" ]

CMD ["app_status_notification", "--config", "/app/config"]
19 changes: 19 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'app_status_notification'

require 'pry-byebug'
require 'awesome_print'

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new

require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)

task(default: %i[spec rubocop])

task :gem_version do
puts "#{AppStatusNotification::NAME}-#{AppStatusNotification::VERSION}"
end
2 changes: 1 addition & 1 deletion app_status_notification.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'app_status_notification/version'

Gem::Specification.new do |spec|
spec.name = 'app_status_notification'
spec.name = AppStatusNotification::NAME
spec.version = AppStatusNotification::VERSION
spec.authors = ['icyleaf']
spec.email = ['icyleaf.cn@gmail.com']
Expand Down
1 change: 1 addition & 0 deletions lib/app_status_notification/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

module AppStatusNotification
NAME = 'app_status_notification'
VERSION = '0.9.0.beta6'
end