Skip to content

Commit b3fa2bb

Browse files
authored
feat: ruby templates updated with os support (#78)
* feat: ruby templates updated with os support * feat: language template added * chore: update checking order
1 parent c2a5ba9 commit b3fa2bb

File tree

4 files changed

+92
-112
lines changed

4 files changed

+92
-112
lines changed

docker_config_generator/config.yaml

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ service_order:
2222
- preactjs
2323
- reactjs
2424
- vuejs
25+
- ruby
2526
- golang
2627
- nodejs
2728
- java-gradle
@@ -127,30 +128,56 @@ services:
127128
static-site:
128129
name: Static Site
129130
description: Static site [HTML, CSS, JS]
131+
ruby:
132+
name: Ruby
133+
description: Ruby based application
130134

131135
templates:
132136
sinatra:
133-
name: sinatra.Dockerfile
137+
name: ruby.Dockerfile
134138
variables:
135-
PORT:
139+
NODE_MAJOR:
136140
type: string
137-
description: Port for sinatra
138-
default: 4567
139-
BUILDPLATFORM:
141+
description: Node major version for rails
142+
default: 18
143+
INSTALL_COMMAND:
140144
type: string
141-
description: Build platform for sinatra
142-
default: x86_64-linux
143-
SERVER:
145+
description: Install dependencies
146+
default: bundle install --without production
147+
START_COMMAND:
144148
type: string
145-
description: Server for sinatra
146-
default: thin
149+
description: Start command for app
150+
default: ruby app.rb -o '0.0.0.0'
147151
rails:
148-
name: rails.Dockerfile
152+
name: ruby.Dockerfile
149153
variables:
154+
NODE_MAJOR:
155+
type: string
156+
description: Node major version for rails
157+
default: 18
158+
INSTALL_COMMAND:
159+
type: string
160+
description: Install dependencies
161+
default: bundle install --without production
150162
START_COMMAND:
151163
type: string
152-
description: Start command for rails
164+
description: Start command for app
153165
default: bundle exec rails server -p 3000 -b '0.0.0.0'
166+
ruby:
167+
name: ruby.Dockerfile
168+
variables:
169+
NODE_MAJOR:
170+
type: string
171+
description: Node major version for rails
172+
default: 18
173+
INSTALL_COMMAND:
174+
type: string
175+
description: Install dependencies
176+
default: bundle install --without production
177+
START_COMMAND:
178+
type: string
179+
description: Start command for app
180+
default:
154181
springboot-maven:
155182
name: java-maven.Dockerfile
156183
variables:
@@ -773,6 +800,17 @@ identifiers:
773800
selectors:
774801
- file: pom.xml
775802
keywords:
803+
ruby:
804+
- extensions:
805+
- rb
806+
selectors:
807+
- file: Gemfile
808+
keywords:
809+
- extensions:
810+
- rb
811+
selectors:
812+
- file: Gemfile.lock
813+
keywords:
776814
static-site:
777815
- extensions:
778816
- html

docker_config_generator/templates/rails.Dockerfile

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Install ruby dependencies
2+
FROM ruby:3.2.2-bullseye
3+
4+
# Build args
5+
ARG NODE_MAJOR
6+
ARG INSTALL_COMMAND
7+
ARG START_COMMAND
8+
9+
RUN mkdir /app
10+
WORKDIR /app
11+
12+
# Install dependencies
13+
RUN apt update -yqq && apt install -yqq ca-certificates cmake curl gnupg imagemagick shared-mime-info libvips
14+
15+
# Install nodejs
16+
RUN mkdir -p /etc/apt/keyrings \
17+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
18+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
19+
&& apt update && apt install nodejs -yqq \
20+
&& npm install -g yarn
21+
22+
# Copy the main application.
23+
COPY . .
24+
25+
# Copy AptFile [optional]
26+
RUN test -f AptFile && apt update -yqq && xargs -a AptFile apt install -yqq || true
27+
28+
# Install dependencies
29+
RUN ${INSTALL_COMMAND}
30+
31+
# Clean up
32+
RUN apt clean && rm -rf /var/lib/apt/lists/*
33+
34+
# Copy SetupCommand [optional]
35+
RUN test -f SetupCommand && while read -r cmd; do eval "$cmd"; done < SetupCommand || true
36+
37+
# Setup entrypoint
38+
RUN echo "${START_COMMAND}" > /app/entrypoint.sh
39+
RUN chmod +x /app/entrypoint.sh
40+
41+
# Run app
42+
CMD ["sh", "-c", "/app/entrypoint.sh"]

docker_config_generator/templates/sinatra.Dockerfile

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)