Added Ruby use case
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
FROM ruby:3.1-alpine
|
||||
|
||||
# Install build tools and libraries needed to build native extensions
|
||||
RUN apk add --no-cache build-base
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Copy the Gemfile and Gemfile.lock into the working directory
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
|
||||
# Install the gems defined in the Gemfile
|
||||
RUN bundle install
|
||||
|
||||
# Copy the current directory contents into the container
|
||||
COPY . .
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
# Run app.rb when the container launches
|
||||
CMD ["ruby", "app.rb"]
|
||||
@@ -0,0 +1,3 @@
|
||||
source 'https://rubygems.org'
|
||||
gem 'sinatra'
|
||||
gem 'puma'
|
||||
@@ -0,0 +1,26 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
base64 (0.2.0)
|
||||
mustermann (3.0.0)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
rack (2.2.9)
|
||||
rack-protection (3.2.0)
|
||||
base64 (>= 0.1.0)
|
||||
rack (~> 2.2, >= 2.2.4)
|
||||
ruby2_keywords (0.0.5)
|
||||
sinatra (3.2.0)
|
||||
mustermann (~> 3.0)
|
||||
rack (~> 2.2, >= 2.2.4)
|
||||
rack-protection (= 3.2.0)
|
||||
tilt (~> 2.0)
|
||||
tilt (2.3.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
sinatra
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.2
|
||||
@@ -0,0 +1,14 @@
|
||||
require 'sinatra'
|
||||
|
||||
set :port, 5000
|
||||
set :bind, '0.0.0.0'
|
||||
|
||||
# Root route - Hello World
|
||||
get '/' do
|
||||
'Hello World from Ruby!'
|
||||
end
|
||||
|
||||
# Admin route
|
||||
get '/admin' do
|
||||
'Ruby Admin area'
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
container_name: ruby-sinatra
|
||||
ports:
|
||||
- "5000:5000"
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
nginx:
|
||||
image: nginx
|
||||
container_name: nginx_ruby
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ../nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
depends_on:
|
||||
- app
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user