Skip to content
Open
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
23 changes: 23 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Ignore bundler config.
/.bundle

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

/node_modules
/yarn-error.log

.byebug_history

/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity

/.*
README.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ yarn-debug.log*

# Ignore application configuration
/config/application.yml
/.tekton/shared-data-pv.yaml
8 changes: 8 additions & 0 deletions .tekton/docker-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
data:
config.json: 'base64 docker encoded credentials'
kind: Secret
metadata:
name: docker-credentials
namespace: default
# type: kubernetes.io/dockerconfigjson
38 changes: 38 additions & 0 deletions .tekton/open-flights-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: open-flights-ci
spec:
description: |
This pipeline clones a git repo, builds a Docker image with Kaniko and
pushes it to a registry
params:
- name: repo-url
type: string
- name: image-reference
type: string
workspaces:
- name: shared-data
- name: docker-credentials
tasks:
- name: fetch-source
taskRef:
name: git-clone
workspaces:
- name: output
workspace: shared-data
params:
- name: url
value: $(params.repo-url)
- name: build-push
runAfter: ["fetch-source"]
taskRef:
name: kaniko
workspaces:
- name: source
workspace: shared-data
- name: dockerconfig
workspace: docker-credentials
params:
- name: IMAGE
value: $(params.image-reference)
27 changes: 27 additions & 0 deletions .tekton/pipeline-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: clone-build-push-run-
spec:
pipelineRef:
name: open-flights-ci
podTemplate:
securityContext:
fsGroup: 65532
workspaces:
- name: shared-data
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 4Gi
- name: docker-credentials
secret:
secretName: docker-credentials
params:
- name: repo-url
value: https://github.com/hawkinswinja/open-flights.git
- name: image-reference
value: hawkinswinja/open-flights:v2
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ruby:latest

WORKDIR /app

RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
apt-get install -y nodejs && npm -g install yarn && yarn -v

COPY Gemfile* .
RUN bundle install
COPY package.json .
RUN yarn install
EXPOSE 3000
COPY . .
# ENTRYPOINT [ "bash" ]
CMD ["rails", "server", "-b", "0.0.0.0"]
19 changes: 11 additions & 8 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,26 @@ default: &default
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: <%= ENV['POSTGRES_USER'] %>
password: <%= ENV['POSTGRES_PASSWORD'] %>
host: <%= ENV['POSTGRES_HOST'] %>

development:
<<: *default
database: open-flights_development

database: <%= ENV['POSTGRES_DB'] %>
# The specified database role being used to connect to postgres.
# To create additional roles in postgres see `$ createuser --help`.
# When left blank, postgres will use the default role. This is
# the same name as the operating system user that initialized the database.
#username: open-flights
# username: ruby

# The password associated with the postgres role (username).
#password:
# password: ruby

# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
#host: localhost
# host: 172.17.0.2

# The TCP port the server listens on. Defaults to 5432.
# If your server runs on a different port number, change accordingly.
Expand Down Expand Up @@ -80,6 +82,7 @@ test:
#
production:
<<: *default
database: open-flights_production
username: open-flights
password: <%= ENV['OPEN-FLIGHTS_DATABASE_PASSWORD'] %>
database: <%= ENV['POSTGRES_DB'] %>
username: <%= ENV['POSTGRES_USER'] %>
password: <%= ENV['POSTGRES_PASSWORD'] %>
host: <%= ENV['POSTGRES_HOST'] %>