Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Existing Docker Compose (Extend)",
"dockerComposeFile": [
"../compose.yml"
],
"service": "app",
"workspaceFolder": "/app",
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/sshd:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"shopify.ruby-extensions-pack",
"testdouble.vscode-standard-ruby"
]
}
}
}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
.bash_history
.idea
.irb_history
.rdbg_history
.cache
.bundle

.ruby-lsp
.vscode-server
.ssh
.gitconfig
.local
.dotnet

.env
vendor/
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"standardRuby.autofix": true
}
53 changes: 41 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,58 @@
FROM ruby:3.2 AS development
################################################################################
# BASE
################################################################################
FROM ruby:3.3-slim AS base

ARG UNAME=app
ARG UID=1000
ARG GID=1000

## Install Vim (optional)
#RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
# vim-tiny

RUN gem install bundler
RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
build-essential \
libtool


RUN groupadd -g ${GID} -o app
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash app

RUN groupadd -g ${GID} -o ${UNAME}
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash ${UNAME}
ENV GEM_HOME=/gems
ENV PATH="$PATH:/gems/bin"
RUN mkdir -p /gems && chown ${UID}:${GID} /gems

USER $UNAME

ENV BUNDLE_PATH /gems
ENV BUNDLE_PATH /app/vendor/bundle

# Change to app and back so that bundler created files in /gmes are owned by the
# app user
USER app
RUN gem install bundler
USER root

WORKDIR /app

CMD ["tail", "-f", "/dev/null"]

FROM development AS production
################################################################################
# DEVELOPMENT #
################################################################################
FROM base AS development

RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
vim-tiny

USER app

################################################################################
# PRODUCTION #
################################################################################
FROM base AS production


ENV BUNDLE_WITHOUT=development:test

COPY --chown=${UID}:${GID} . /app
RUN bundle install

USER app

RUN bundle install

4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
source "https://rubygems.org"

group :development, :test do
gem "pry"
gem "pry-byebug"
gem "debug"
end

group :test do
Expand All @@ -13,4 +12,5 @@ end

group :development do
gem "standard"
gem "ruby-lsp"
end
108 changes: 108 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
date (3.4.1)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
diff-lcs (1.5.1)
docile (1.4.1)
io-console (0.8.0)
irb (1.14.2)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.9.0)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
logger (1.6.3)
parallel (1.26.3)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
prism (1.2.0)
psych (5.2.1)
date
stringio
racc (1.8.1)
rainbow (3.1.1)
rbs (3.7.0)
logger
rdoc (6.9.0)
psych (>= 4.0.0)
regexp_parser (2.9.3)
reline (0.6.0)
io-console (~> 0.5)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.2)
rubocop (1.69.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-performance (1.23.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-lsp (0.22.1)
language_server-protocol (~> 3.17.0)
prism (>= 1.2, < 2.0)
rbs (>= 3, < 4)
sorbet-runtime (>= 0.5.10782)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.1)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
sorbet-runtime (0.5.11691)
standard (1.43.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.69.1)
standard-custom (~> 1.0.0)
standard-performance (~> 1.6)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.6.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.23.0)
stringio (3.1.2)
unicode-display_width (3.1.2)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
debug
rspec
ruby-lsp
simplecov
simplecov-lcov
standard

BUNDLED WITH
2.6.3
6 changes: 3 additions & 3 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ services:
build:
context: .
target: development
args:
UID: ${UID:-1000}
GID: ${GID:-1000}
volumes:
- .:/app
- gem_cache:/gems
env_file:
- .env

volumes:
gem_cache:
2 changes: 2 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
UID=YOUR_UID
GID=YOUR_GID
SEKRET="aweflweif;wltgi5t13o5i"
5 changes: 5 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ if [ -f ".env" ]; then
else
echo "🌎 .env does not exist. Copying .env-example to .env"
cp env.example .env
YOUR_UID=$(id -u)
YOUR_GID=$(id -g)
echo "🙂 Setting your UID (${YOUR_UID}) and GID (${YOUR_UID}) in .env"
docker run --rm -v ./.env:/.env alpine echo "$(sed s/YOUR_UID/${YOUR_UID}/ .env)" >.env
docker run --rm -v ./.env:/.env alpine echo "$(sed s/YOUR_GID/${YOUR_GID}/ .env)" >.env
fi

if [ -f ".git/hooks/pre-commit" ]; then
Expand Down