Attempt to add Docker (via Rails 7.1 file)
This commit is contained in:
parent
fd75a7c6ff
commit
faef71fb9c
4 changed files with 138 additions and 37 deletions
28
.dockerignore
Normal file
28
.dockerignore
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
|
||||||
|
|
||||||
|
# Ignore bundler config.
|
||||||
|
/.bundle
|
||||||
|
|
||||||
|
# Ignore all default key files
|
||||||
|
config/master.key
|
||||||
|
config/credentials/*.key
|
||||||
|
|
||||||
|
# Ignore all logfiles and tempfiles.
|
||||||
|
/log/*
|
||||||
|
/tmp/*
|
||||||
|
!/log/.keep
|
||||||
|
!/tmp/.keep
|
||||||
|
|
||||||
|
# Ignore pidfiles, but keep the directory.
|
||||||
|
/tmp/pids/*
|
||||||
|
!/tmp/pids/
|
||||||
|
!/tmp/pids/.keep
|
||||||
|
|
||||||
|
# Ignore storage (uploaded files in development and any SQLite databases).
|
||||||
|
/storage/*
|
||||||
|
!/storage/.keep
|
||||||
|
/tmp/storage/*
|
||||||
|
!/tmp/storage/
|
||||||
|
!/tmp/storage/.keep
|
||||||
|
|
||||||
|
/public/assets
|
108
.drone.yml
108
.drone.yml
|
@ -2,45 +2,79 @@ name: default
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: install
|
- name: install
|
||||||
image: ruby:3.2.0
|
image: ruby:3.2.0
|
||||||
volumes:
|
volumes:
|
||||||
- name: bundle
|
- name: bundle
|
||||||
path: /usr/local/bundle
|
path: /usr/local/bundle
|
||||||
commands:
|
commands:
|
||||||
- bin/bundle install --jobs=3 --retry=3
|
- bin/bundle install --jobs=3 --retry=3
|
||||||
|
|
||||||
- name: autoload
|
- name: autoload
|
||||||
image: ruby:3.2.0
|
image: ruby:3.2.0
|
||||||
volumes:
|
volumes:
|
||||||
- name: bundle
|
- name: bundle
|
||||||
path: /usr/local/bundle
|
path: /usr/local/bundle
|
||||||
commands:
|
commands: - bin/rails zeitwerk:check
|
||||||
- bin/rails zeitwerk:check
|
depends_on:
|
||||||
depends_on:
|
- install
|
||||||
- install
|
|
||||||
|
|
||||||
- name: lint
|
- name: lint
|
||||||
image: ruby:3.2.0
|
image: ruby:3.2.0
|
||||||
volumes:
|
volumes:
|
||||||
- name: bundle
|
- name: bundle
|
||||||
path: /usr/local/bundle
|
path: /usr/local/bundle
|
||||||
commands:
|
commands:
|
||||||
- bin/bundle exec standardrb
|
- bin/bundle exec standardrb
|
||||||
depends_on:
|
depends_on:
|
||||||
- install
|
- install
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
image: ruby:3.2.0
|
image: ruby:3.2.0
|
||||||
volumes:
|
volumes:
|
||||||
- name: bundle
|
- name: bundle
|
||||||
path: /usr/local/bundle
|
path: /usr/local/bundle
|
||||||
commands:
|
commands:
|
||||||
- bin/rails assets:precompile
|
- bin/rails assets:precompile
|
||||||
- bin/rails test
|
- bin/rails test
|
||||||
depends_on:
|
depends_on:
|
||||||
- install
|
- install
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: bundle
|
- name: bundle
|
||||||
temp: {}
|
temp: {}
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
exclude: master
|
||||||
|
event: push
|
||||||
|
|
||||||
|
---
|
||||||
|
name: deploy
|
||||||
|
kind: pipeline
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: docker-build
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
pull_image: true
|
||||||
|
registry: docker.atomaka.com
|
||||||
|
repo: docker.atomaka.com/budget
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- ${DRONE_TAG}
|
||||||
|
- name: deploy
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: unraid_host
|
||||||
|
username:
|
||||||
|
from_secret: unraid_username
|
||||||
|
key:
|
||||||
|
from_secret: unraid_ssh_key
|
||||||
|
script:
|
||||||
|
- docker pull docker.atomaka.com/budget:latest
|
||||||
|
- docker restart budget
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event: tag
|
||||||
|
|
27
Dockerfile
Normal file
27
Dockerfile
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Make sure it matches the Ruby version in .ruby-version and Gemfile
|
||||||
|
ARG RUBY_VERSION=3.2.0
|
||||||
|
FROM ruby:$RUBY_VERSION
|
||||||
|
|
||||||
|
# Set production environment
|
||||||
|
ENV RAILS_LOG_TO_STDOUT="1" \
|
||||||
|
RAILS_SERVE_STATIC_FILES="true" \
|
||||||
|
RAILS_ENV="production" \
|
||||||
|
BUNDLE_WITHOUT="development:test"
|
||||||
|
|
||||||
|
# Install application gems
|
||||||
|
COPY Gemfile Gemfile.lock ./
|
||||||
|
RUN bundle install
|
||||||
|
|
||||||
|
# Copy application code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Precompile bootsnap code for faster boot times
|
||||||
|
RUN bundle exec bootsnap precompile --gemfile app/ lib/
|
||||||
|
|
||||||
|
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
|
||||||
|
RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile
|
||||||
|
|
||||||
|
# Entrypoint prepares database and starts app on 0.0.0.0:3000 by default,
|
||||||
|
# but can also take a rails command, like "console" or "runner" to start instead.
|
||||||
|
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
||||||
|
EXPOSE 3000
|
12
bin/docker-entrypoint
Executable file
12
bin/docker-entrypoint
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
# Create new or migrate existing database
|
||||||
|
./bin/rails db:prepare
|
||||||
|
|
||||||
|
# Start the server by default
|
||||||
|
exec bin/rails server
|
||||||
|
else
|
||||||
|
# Allow other commands, like console or runner, to be called
|
||||||
|
exec bin/rails "$@"
|
||||||
|
fi
|
Loading…
Reference in a new issue