Skip to content

Commit

Permalink
add version and update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdaniellewis committed Feb 13, 2023
1 parent 174eefe commit a0fc569
Show file tree
Hide file tree
Showing 13 changed files with 125 additions and 77 deletions.
Binary file removed .Dockerfile.swp
Binary file not shown.
46 changes: 12 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,16 @@ jobs:
docker-compose run -e APP_ENV=test --rm app bundle exec rspec
build:
runs-on: ubuntu-latest
name: Publish image
runs-on: ubuntu-22.04
needs: test
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Extract repo name
shell: bash
run: echo "##[set-output name=repo_name;]$(echo ${GITHUB_REPOSITORY} | sed "s/.*\///g" | sed "s/-docker$//")"
id: extract_repo_name
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: public.ecr.aws/citizensadvice/${{ steps.extract_repo_name.outputs.repo_name }}
tag-sha: true
- name: Login to AWS Elastic Container Registry
uses: docker/login-action@v1
with:
registry: public.ecr.aws
username: ${{ secrets.PUBLIC_PUSH_ECR_AWS_KEY }}
password: ${{ secrets.PUBLIC_PUSH_ECR_AWS_SECRET }}
env:
AWS_REGION: us-east-1
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
- name: Build and push to ECR
uses: citizensadvice/build-and-push-action@v1
with:
aws_access_key: ${{ secrets.PUBLIC_PUSH_ECR_AWS_KEY }}
aws_secret_key: ${{ secrets.PUBLIC_PUSH_ECR_AWS_SECRET }}
dockerfile_context: '.'
repository_name: image-resizer
multiarch_build: 'enabled'
auth_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
*.swp
*.log
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.0
3.2.1
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## v2.2.0 _2023-02-13_

- Added a version endpoint
- New Relic now defaults to off
- Updated to Ruby 3.2.1

## v2.1.0 _2023-01-31_

- `mime_type` param is no longer required. The application will now determine the mime-type.
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.2.0-alpine3.17 as builder
FROM ruby:3.2.1-alpine3.17 as builder

ENV LANG C.UTF-8
WORKDIR /app
Expand All @@ -17,7 +17,7 @@ RUN gem install bundler \

#################################################

FROM ruby:3.2.0-alpine3.17
FROM ruby:3.2.1-alpine3.17

WORKDIR /app
ENV RACK_ENV=production
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.2.0"
ruby "3.2.1"

gem "image_processing"
gem "puma"
Expand All @@ -14,7 +14,7 @@ gem "svg_optimizer"
gem "newrelic_rpm"

group :development, :test do
gem "citizens-advice-style", github: "citizensadvice/citizens-advice-style-ruby", tag: "v9.0.0"
gem "citizens-advice-style", github: "citizensadvice/citizens-advice-style-ruby", tag: "v10.0.0"
gem "debug"
gem "rack-test"
gem "rspec"
Expand Down
64 changes: 39 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
GIT
remote: https://github.com/citizensadvice/citizens-advice-style-ruby.git
revision: 1a0f7e2cdcfd455a1c4d757c03d1c45eb160551d
tag: v9.0.0
revision: 399708d8878e96a811c99af041d12f9f9e58d4dc
tag: v10.0.0
specs:
citizens-advice-style (9.0.0)
rubocop (~> 1.30.1)
rubocop-rspec (~> 2.11.1)
rubocop (~> 1.45)
rubocop-rails (~> 2.17)
rubocop-rspec (~> 2.18)

GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.4.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
ast (2.4.2)
concurrent-ruby (1.2.0)
debug (1.7.1)
irb (>= 1.5.0)
reline (>= 0.3.1)
diff-lcs (1.5.0)
ffi (1.15.5)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.6.0)
irb (1.6.2)
reline (>= 0.3.0)
json (2.6.3)
mini_magick (4.12.0)
minitest (5.17.0)
multi_json (1.15.0)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
newrelic_rpm (8.15.0)
newrelic_rpm (8.16.0)
nio4r (2.5.8)
nokogiri (1.14.1-aarch64-linux)
racc (~> 1.4)
Expand All @@ -37,9 +43,9 @@ GEM
nokogiri (1.14.1-x86_64-linux)
racc (~> 1.4)
parallel (1.22.1)
parser (3.2.0.0)
parser (3.2.1.0)
ast (~> 2.4.1)
puma (6.0.2)
puma (6.1.0)
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.6.2)
Expand All @@ -48,9 +54,7 @@ GEM
rack-test (2.0.2)
rack (>= 1.3)
rainbow (3.1.1)
regexp_parser (2.6.2)
reline (0.3.2)
io-console (~> 0.5)
regexp_parser (2.7.0)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
Expand All @@ -65,19 +69,27 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.30.1)
rubocop (1.45.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.18.0, < 2.0)
rubocop-ast (>= 1.24.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
rubocop-rspec (2.11.1)
rubocop (~> 1.19)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.26.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.17.0)
rubocop (~> 1.41)
rubocop-rails (2.17.4)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-rspec (2.18.1)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
ruby-progressbar (1.11.0)
ruby-vips (2.1.4)
ffi (~> 1.12)
Expand All @@ -96,6 +108,8 @@ GEM
svg_optimizer (0.2.6)
nokogiri
tilt (2.0.11)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)

PLATFORMS
Expand All @@ -117,7 +131,7 @@ DEPENDENCIES
svg_optimizer

RUBY VERSION
ruby 3.2.0p0
ruby 3.2.1p31

BUNDLED WITH
2.4.5
2.4.6
5 changes: 5 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require_relative "lib/version"
require_relative "lib/image_resize_service"
require "sinatra"
require "newrelic_rpm"
Expand All @@ -10,6 +11,10 @@
body "Image Resizer service is running"
end

get "/version" do
VERSION
end

post "/image" do
image_file = params[:image_file]&.[](:tempfile)
halt 400, "no image file was provided" unless image_file.is_a?(Tempfile)
Expand Down
17 changes: 17 additions & 0 deletions config/newrelic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration
common: &default_settings
app_name: Image resizer
agent_enabled: <%= ENV["NEW_RELIC_LICENSE_KEY"].to_s.strip.empty? ? false : true %>
browser_monitoring:
auto_instrument: false

development:
<<: *default_settings
agent_enabled: false

test:
<<: *default_settings
monitor_mode: false

production:
<<: *default_settings
3 changes: 3 additions & 0 deletions lib/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

VERSION = "2.2.0"
Loading

0 comments on commit a0fc569

Please sign in to comment.