Skip to content

Commit

Permalink
Merge pull request #148 from kaishuu0123/master
Browse files Browse the repository at this point in the history
v2.0.0
  • Loading branch information
kaishuu0123 authored Jul 23, 2024
2 parents 9d9121a + 5524990 commit 0676c8d
Show file tree
Hide file tree
Showing 66 changed files with 3,482 additions and 2,571 deletions.
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu

ENV BUNDLER_VERSION 2.5.7

RUN apt -y update && apt -y upgrade && apt -y install libpq-dev
2 changes: 2 additions & 0 deletions .devcontainer/create-db-user.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE USER vscode CREATEDB;
CREATE DATABASE vscode WITH OWNER vscode;
69 changes: 69 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby-rails-postgres
{
"name": "Ruby on Rails & Postgres",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
"features": {
"ghcr.io/devcontainers/features/ruby:1": {
"version": "3.3.1"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "16.20.2"
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or the host.
// "forwardPorts": [3000, 5432],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "bundle install && rake db:setup",
"postCreateCommand": "gem install bundler --version 2.5.7",

// Configure tool-specific properties.
// "customizations": {},

"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash",
"args": ["-l"]
}
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.workingDirectories": [{ "mode": "auto" }],
"rubyLsp.erbSupport": false,
"rubyLsp.rubyVersionManager": "none",
"[ruby]": {
"editor.defaultFormatter": "Shopify.ruby-lsp",
"editor.semanticHighlighting.enabled": true
}
},
"extensions": [
// Add the IDs of extensions you want installed when the container is created.
"cschleiden.vscode-github-actions",
"editorconfig.editorconfig",
"vscode-icons-team.vscode-icons",
"Shopify.ruby-lsp",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"stylelint.vscode-stylelint",
"mikestead.dotenv",
"mhutchie.git-graph"
]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
48 changes: 48 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: '3'

services:
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile

volumes:
- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

db:
image: postgres:16.3
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
- ./create-db-user.sql:/docker-entrypoint-initdb.d/create-db-user.sql
environment:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
# Your config/database.yml should use the user and password you set here,
# and host "db" (as that's the name of this service). You can use whatever
# database name you want. Use `bin/rails db:prepare` to create the database.
#
# Example:
#
# development:
# <<: *default
# host: db
# username: postgres
# password: postgres
# database: myapp_development

# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

volumes:
postgres-data:
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: https://EditorConfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
40 changes: 40 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly

- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
versioning-strategy: lockfile-only
labels:
- "dependencies"
- "gem"
- "ruby"
allow:
- dependency-type: "all"
# ignore:
# - dependency-name: "example"
# versions:
# - "> 1.0.0"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
versioning-strategy: lockfile-only
labels:
- "dependencies"
- "npm"
- "javascript"
37 changes: 37 additions & 0 deletions .github/workflows/build-and-push-to-ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Publish Docker

on:
push:
branches:
- master

jobs:
build_and_push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
IMAGE_NAME: rebacklogs
steps:
- name: checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.3
3.3.1
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# refs: https://github.com/tootsuite/mastodon
# refs: https://qiita.com/baban/items/99877f9b3065c4cf3d50

FROM node:8.9.4-alpine as node
FROM node:16.20.2-alpine as node

FROM ruby:2.5.3-alpine as builder
FROM ruby:3.3.1-alpine as builder

ENV BUNDLER_VERSION 2.5.7

RUN apk --update --no-cache add bash bash-completion

Expand All @@ -24,7 +26,7 @@ COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -s /usr/local/bin/node /usr/local/bin/nodejs && \
ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm

RUN gem install bundler --version 1.17.3 && \
RUN gem install bundler --version ${BUNDLER_VERSION} && \
bundle install --without development test --path vendor/bundle && \
find vendor/bundle/ruby -path '*/gems/*/ext/*/Makefile' -exec dirname {} \; | xargs -n1 -P$(nproc) -I{} make -C {} clean

Expand All @@ -46,7 +48,7 @@ ENV NODE_ENV="production"
RUN cd /opt/rebacklogs && \
SECRET_KEY_BASE=precompile_placeholder bin/rails assets:precompile

FROM ruby:2.5.3-alpine
FROM ruby:3.3.1-alpine

# install rails require minimum package
RUN apk --update --no-cache add \
Expand Down
23 changes: 10 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.3'
# ruby '~> 3.3'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
# Full-stack web application framework. (https://rubyonrails.org)
gem 'rails', '~> 6.0.0'
gem 'rails', '~> 7.1.3', '>= 7.1.3.2'
# Use Puma as the app server
# Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications (http://puma.io)
gem 'puma', '~> 3.12'
gem 'puma', '>= 5.0'
# Use SCSS for stylesheets
# Sass adapter for the Rails asset pipeline. (https://github.com/rails/sass-rails)
gem 'sass-rails', '~> 5'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
# Use webpack to manage app-like JavaScript modules in Rails (https://github.com/rails/webpacker)
gem 'webpacker', '~> 4.0'
gem 'webpacker', '~> 5.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# Create JSON structures via a Builder-style DSL (https://github.com/rails/jbuilder)
gem 'jbuilder', '~> 2.7'
gem 'jbuilder'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
Expand All @@ -28,7 +28,7 @@ gem 'jbuilder', '~> 2.7'

# Reduces boot times through caching; required in config/boot.rb
# Boot large ruby/rails apps faster (https://github.com/Shopify/bootsnap)
gem 'bootsnap', '>= 1.4.2', require: false
# gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
# Use sqlite3 as the database for Active Record
Expand All @@ -37,7 +37,7 @@ group :development, :test do

# Call 'byebug' anywhere in the code to stop execution and get a debugger console
# Ruby fast debugger - base + CLI (https://github.com/deivid-rodriguez/byebug)
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'byebug', platforms: %i[mri mingw x64_mingw]
end

group :development do
Expand All @@ -51,8 +51,6 @@ group :development do
gem 'spring'
# Makes spring watch files using the listen gem. (https://github.com/jonleighton/spring-watcher-listen)
gem 'spring-watcher-listen', '~> 2.0.0'
# Solargraph for Ruby (http://solargraph.org)
gem 'solargraph'
# Automatic Ruby code style checking tool. (https://github.com/rubocop-hq/rubocop)
gem 'rubocop'
# An IRB alternative and runtime developer console (http://pryrepl.org)
Expand Down Expand Up @@ -85,7 +83,7 @@ end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
# Timezone Data for TZInfo (http://tzinfo.github.io)
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

# Flexible authentication solution for Rails with Warden (https://github.com/plataformatec/devise)
gem 'devise'
Expand All @@ -102,7 +100,7 @@ gem 'ranked-model', '~> 0.4'
# Track changes to your models. (https://github.com/paper-trail-gem/paper_trail)
gem 'paper_trail', '~> 10.3.0'
# Common locale data and translations for Rails i18n. (http://github.com/svenfuchs/rails-i18n)
gem 'rails-i18n', '~> 6.0.0' # For 6.0.0 or higher
gem 'rails-i18n', '~> 7.0.9' # For 6.0.0 or higher
# Forms made easy! (https://github.com/plataformatec/simple_form)
gem 'simple_form'

Expand All @@ -115,11 +113,10 @@ gem 'cancancan'
gem 'rails-settings-cached', '~> 2.0'

gem 'omniauth', '~> 1.9'
gem 'omniauth-twitter', '~> 1.4'
gem 'omniauth-github', '~> 1.3'
gem 'omniauth-google-oauth2', '~> 0.8'

gem 'config'

gem 'gravatar_image_tag'
gem 'kaminari', '~> 1.2'
gem 'gravatar_image_tag'
Loading

0 comments on commit 0676c8d

Please sign in to comment.