Skip to content

Instantly share code, notes, and snippets.

@wshihadeh
wshihadeh / Dockerfile
Last active October 20, 2019 17:16
Rails docker base image file
FROM ruby:2.6.4-alpine
MAINTAINER Al-waleed Shihadeh <wshihadeh.dev@gmail.com>
ENV PORT 8080
ENV RACK_ENV=production RAILS_ENV=production
ENV RAILS_LOG_TO_STDOUT=true
ENV SECRET_KEY_BASE changeme
EXPOSE 8080
@wshihadeh
wshihadeh / Dockerfile.erb
Created October 20, 2019 18:17
Docker base image template
FROM ruby:<%= ruby_version %>-alpine
MAINTAINER Al-waleed Shihadeh <wshihadeh.dev@gmail.com>
ENV PORT 8080
ENV RACK_ENV=production RAILS_ENV=production
ENV RAILS_LOG_TO_STDOUT=true
ENV SECRET_KEY_BASE changeme
EXPOSE 8080
@wshihadeh
wshihadeh / images.yaml
Last active October 20, 2019 18:30
Yaml file for supported docker images
images:
# Ruby 2.6.3
- name: rails-base-image-ruby:2.6.3
ruby_version: 2.6.3
additional_pkgs: []
- name: rails-base-image-ruby:2.6.3-mysql
ruby_version: 2.6.3
additional_pkgs:
- mariadb-dev
@wshihadeh
wshihadeh / dockerfile.rb
Last active October 20, 2019 18:42
Create docker files
require 'fileutils'
module RailsBaseImages
class Dockerfile
attr_accessor :ruby_version, :additional_pkgs
def initialize(attributes = {})
attributes.each do |key, value|
public_send("#{key}=", value)
end
@wshihadeh
wshihadeh / travis.yaml
Last active October 20, 2019 19:28
Travis file
language: ruby
rvm:
- "2.6.4"
branches:
only:
- master
before_script:
- echo $DOCKER_TOKEN | docker login -u $DOCKER_NAMESPACE --password-stdin
script:
- ./create_docker_files
@wshihadeh
wshihadeh / Dockerfile
Last active October 20, 2019 19:35
Rails app docker file
FROM wshihadeh/rails-base-image-ruby:2.6.3-mysql
MAINTAINER Al-waleed Shiahdeh <wshihadeh.dev@gmail.com>
COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
WORKDIR /application
RUN bundle install --without development test && rails assets:precompile
@wshihadeh
wshihadeh / Jenkinsfile
Last active December 4, 2019 15:29
Orca Jenkins file
pipeline {
/* specify nodes for executing */
agent {
label 'ci-deployment'
}
/* log rotation */
options {
buildDiscarder(logRotator(numToKeepStr: '50'))
}
@wshihadeh
wshihadeh / Jenkinsfile
Created December 5, 2019 18:16
Jenkins Pipeline for github webhooks
properties([pipelineTriggers([githubPush()])])
pipeline {
/* specify nodes for executing */
agent {
label 'github-ci'
}
stages {
/* checkout repo */
@wshihadeh
wshihadeh / Makefile
Created December 11, 2019 16:39
Dokcer Image Makefile
# The Project namespace, wshihadeh by default
NAMESPACE ?= wshihadeh
# Image name: simply we can use the application name
IMAGE_NAME := simple-rails
# The URL of Docker registry used to host the image.
REGISTRY ?= index.docker.io
# Docker image full name
@wshihadeh
wshihadeh / Jenkinsfile
Created December 11, 2019 22:30
Jenkinsfile for building docker file
pipeline {
agent { label 'ci-docker' }
parameters {
string(name: 'REPO', defaultValue: 'git@github.com:wshihadeh/sample_app.git', description: 'The git repository')
string(name: 'BRANCH', defaultValue: 'master', description: 'Branch to build')
string(name: 'NAMESPACE', defaultValue: 'wshihadeh', description: 'Namespace for the Docker Image')
string(name: 'REGISTRY', defaultValue: 'index.docker.io', description: 'Registry to be used')
}