Skip to content

Commit

Permalink
Update deployment configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
delonnewman committed Feb 24, 2024
1 parent fbd7b53 commit 90caca5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
13 changes: 11 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented_relative_to_receiver

Metrics/MethodLength:
Max: 15
Enabled: false

Metrics/ModuleLength:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false
Expand All @@ -38,8 +41,14 @@ Style/Documentation:
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma

Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma

Style/MultipleComparison:
ComparisonsThreshold: 3

Style/Alias:
EnforcedStyle: prefer_alias
EnforcedStyle: prefer_alias

Rails/DynamicFindBy:
Enabled: false
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ARG RUBY_VERSION=3.2.2
FROM ruby:$RUBY_VERSION-slim as base

LABEL org.opencontainers.image.source = "https://ghcr.io/delonnewman/dragnet"
LABEL org.opencontainers.image.source = "https://github.com/delonnewman/dragnet"

# Rails app lives here
WORKDIR /rails
Expand Down
14 changes: 9 additions & 5 deletions lib/tasks/deploy.rake
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
namespace :deploy do
namespace :deployment do
namespace :build do
desc 'build assets for deployment (including frontend code)'
desc 'Build assets for deployment (including frontend code)'
task assets: %i[assets:precompile frontend:build]

task all: %i[deploy:build:assets docker:image]
task all: %i[deploy:build:assets docker:image:build]
end

task build: %i[deploy:build:all]
end
desc 'Perform a complete build of the system as a Docker image'
task build: %i[deployment:build:all]

desc 'Push image to container registry'
task push: %i[docker:image:push]
end
10 changes: 5 additions & 5 deletions lib/tasks/docker.rake
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace :docker do
namespace :image do
desc 'Build docker image'
desc 'Build Docker image'
task build: :environment do
sh "docker build -t ghcr.io/delonnewman/dragnet:#{Dragnet.release}" \
" -t ghcr.io/delonnewman/dragnet:#{Dragnet.version} -t docker.io/delonnewman/dragnet:latest ."
" -t ghcr.io/delonnewman/dragnet:#{Dragnet.version} -t ghcr.io/delonnewman/dragnet:latest ."
end

desc 'Push docker image'
desc 'Push Docker image'
task push: :environment do
sh 'docker push -a ghcr.io/delonnewman/dragnet'
end
Expand All @@ -27,12 +27,12 @@ namespace :docker do
sh 'docker container start dragnet'
end

desc 'Start an already created container'
desc 'Stop created container'
task stop: :environment do
sh 'docker container stop dragnet'
end

desc 'Start an already created container'
desc 'Remove created container'
task remove: :environment do
sh 'docker container rm dragnet'
end
Expand Down
8 changes: 4 additions & 4 deletions lib/tasks/frontend.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
FRONTEND_SOURCE_PATH = 'app/assets/javascripts/frontend'

namespace :frontend do
desc 'start dev server for frontend'
desc 'Start dev server for frontend'
task server: :environment do
sh "cd #{FRONTEND_SOURCE_PATH} && npm run watch"
end

desc 'install frontend dependencies'
desc 'Install frontend dependencies'
task deps: :environment do
sh "cd #{FRONTEND_SOURCE_PATH} && npm install"
end

desc 'build frontend for production'
desc 'Build frontend for production'
task build: :clean do
sh "cd #{FRONTEND_SOURCE_PATH} && npm run build"
end

desc 'remove frontend code'
desc 'Remove frontend code'
task clean: :environment do
sh 'rm -rf public/js/editor && rm -rf public/js/submitter'
end
Expand Down

0 comments on commit 90caca5

Please sign in to comment.