Skip to content

Commit 1659576

Browse files
committed
initial commit
0 parents  commit 1659576

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1037
-0
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "Rails API Container",
3+
"dockerComposeFile": ["../docker-compose.yml"],
4+
"service": "api",
5+
"shutdownAction": "stopCompose",
6+
"workspaceFolder": "/workspace",
7+
// https://containers.dev/features
8+
"features": {
9+
"ghcr.io/devcontainers/features/aws-cli:1": {},
10+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
11+
},
12+
// Update the source path
13+
"mounts": [
14+
{
15+
"source": "/Users/<USERNAME>/.ssh",
16+
"target": "/home/vscode/.ssh",
17+
"type": "bind"
18+
},
19+
{
20+
"source": "/Users/<USERNAME>/.aws",
21+
"target": "/home/vscode/.aws",
22+
"type": "bind"
23+
}
24+
]
25+
}

.dockerignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2+
3+
# Ignore git directory.
4+
/.git/
5+
6+
# Ignore bundler config.
7+
/.bundle
8+
9+
# Ignore all environment files (except templates).
10+
/.env*
11+
!/.env*.erb
12+
13+
# Ignore all default key files.
14+
/config/master.key
15+
/config/credentials/*.key
16+
17+
# Ignore all logfiles and tempfiles.
18+
/log/*
19+
/tmp/*
20+
!/log/.keep
21+
!/tmp/.keep
22+
23+
# Ignore pidfiles, but keep the directory.
24+
/tmp/pids/*
25+
!/tmp/pids/.keep
26+
27+
# Ignore storage (uploaded files in development and any SQLite databases).
28+
/storage/*
29+
!/storage/.keep
30+
/tmp/storage/*
31+
!/tmp/storage/.keep

.gitattributes

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
2+
3+
4+
# Mark any vendored files as having been vendored.
5+
vendor/* linguist-vendored
6+
config/credentials/*.yml.enc diff=rails_credentials
7+
config/credentials.yml.enc diff=rails_credentials

.gitignore

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile '~/.gitignore_global'
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore all environment files (except templates).
11+
/.env*
12+
!/.env*.erb
13+
14+
# Ignore all logfiles and tempfiles.
15+
/log/*
16+
/tmp/*
17+
!/log/.keep
18+
!/tmp/.keep
19+
20+
# Ignore pidfiles, but keep the directory.
21+
/tmp/pids/*
22+
!/tmp/pids/
23+
!/tmp/pids/.keep
24+
25+
# Ignore storage (uploaded files in development and any SQLite databases).
26+
/storage/*
27+
!/storage/.keep
28+
/tmp/storage/*
29+
!/tmp/storage/
30+
!/tmp/storage/.keep
31+
32+
# Ignore master key for decrypting credentials and more.
33+
/config/master.key
34+
35+
.devcontainer/devcontainer.json
36+
docker-compose.yml

.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby-3.3.1

Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# syntax = docker/dockerfile:1
2+
3+
# Stage 1: Builder (base image that can be used for local deve or to run unit tests on CI)
4+
FROM ruby:3.3.4 AS builder
5+
RUN mkdir /app
6+
WORKDIR /app
7+
RUN apt-get update -qq && \
8+
apt-get -y install build-essential
9+
ADD Gemfile /app/Gemfile
10+
ADD Gemfile.lock /app/Gemfile.lock
11+
RUN bundle install
12+
13+
# Stage 2: develop (for local development setup)
14+
FROM builder AS develop
15+
RUN apt-get update && \
16+
apt-get install -y less
17+
WORKDIR /workspace
18+
CMD [ "bundle", "exec", "rails", "s", "-b", "0.0.0.0" ]
19+
20+
# Stage 3: prod-build (intermediate stage that builds prod artifacts)
21+
FROM builder AS prod-build
22+
COPY . /app
23+
# RUN rails assets:precompile
24+
RUN bundle config set --local without 'development test' && \
25+
bundle config set --local path /rubygems
26+
RUN bundle install
27+
28+
# Stage 4: prod (image that will be deployed all of the environments - qa, staging, prod etc.)
29+
FROM ruby:3.3.4-slim AS prod
30+
RUN mkdir /app
31+
WORKDIR /app
32+
COPY --from=prod-build /app /app
33+
COPY --from=prod-build /rubygems /rubygems
34+
RUN bundle config set --local without 'development test' && \
35+
bundle config set --local path /rubygems
36+
ENV RAILS_ENV="production"
37+
ENV SECRET_KEY_BASE="this_is_demo-not_important"
38+
CMD [ "bundle", "exec", "rails", "s", "-b", "0.0.0.0" ]

Gemfile

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
source "https://rubygems.org"
2+
3+
ruby "3.3.4"
4+
5+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
6+
gem "rails", "~> 7.1.3", ">= 7.1.3.2"
7+
8+
# Use the Puma web server [https://github.com/puma/puma]
9+
gem "puma", ">= 5.0"
10+
11+
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
12+
# gem "jbuilder"
13+
14+
# Use Redis adapter to run Action Cable in production
15+
# gem "redis", ">= 4.0.1"
16+
17+
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
18+
# gem "kredis"
19+
20+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
21+
# gem "bcrypt", "~> 3.1.7"
22+
23+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
24+
gem "tzinfo-data", platforms: %i[ windows jruby ]
25+
26+
# Reduces boot times through caching; required in config/boot.rb
27+
gem "bootsnap", require: false
28+
29+
gem 'aws-sdk-dynamodb', '~> 1.118.0'
30+
gem 'aws-sdk-rails', '~> 4.0.3'
31+
32+
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin Ajax possible
33+
# gem "rack-cors"
34+
35+
group :development, :test do
36+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
37+
gem "debug", platforms: %i[ mri windows ]
38+
end
39+
40+
group :development do
41+
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
42+
# gem "spring"
43+
end
44+

0 commit comments

Comments
 (0)