This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
jenkins: | |
image: jenkins/jenkins:jdk11 | |
environment: | |
- JAVA_OPTS=-Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true -Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true | |
ports: | |
- 8080:8080 | |
volumes: | |
- jenkins_home:/var/jenkins_home |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
jenkins: | |
image: jenkins/jenkins:jdk11 | |
ports: | |
- 8080:8080 | |
volumes: | |
- jenkins_home:/var/jenkins_home | |
volumes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM anycable/anycable-go:1.2 | |
ENV ANYCABLE_HOST=0.0.0.0 | |
ENV ANYCABLE_REDIS_URL=redis://redis:6379/0 | |
ENV ANYCABLE_RPC_HOST=anycable:50051 | |
ENV ANYCABLE_DEBUG=1 | |
ENV ANYCABLE_PORT=8085 | |
EXPOSE 50051 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.3" | |
x-image-build: &image_build | |
env_file: .env | |
build: | |
context: . | |
dockerfile: Dockerfile.development | |
stdin_open: true | |
tty: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/images_controller.rb | |
class ImagesController < ApplicationController | |
skip_before_action :verify_authenticity_token, only: :convert_heic | |
def convert_heic | |
tempfile = ImageConverter.new(tempfile: params[:image].tempfile, height: 400).call | |
render json: tempfile.read, content_type: 'image/jpg' | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app/javascript/controllers/image_preview_controller.js | |
import ApplicationController from "./application_controller"; | |
export default class extends ApplicationController { | |
static targets = ["imagePreview"]; | |
... | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/services/image_converter.rb | |
class ImageConverter | |
def initialize(tempfile:, width: nil, height: nil, type: 'jpg') | |
@tempfile = tempfile | |
@width = width | |
@height = height | |
@type = type | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/records_controller.rb | |
def some_method | |
... business logic ... | |
attaching_images = params[:record][:images].presence | |
if attaching_images | |
attaching_images = attaching_images.map do |im| | |
tempfile = ImageConverter.new(tempfile: im.tempfile, width: 1200).call | |
ActionDispatch::Http::UploadedFile.new( |
NewerOlder