Skip to content

Commit

Permalink
Add docker config files
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdavidhamilton committed Feb 17, 2021
1 parent 3fa66aa commit f26cc0b
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# vim:set ft=dockerfile:

FROM ruby:2.7-alpine as app

LABEL maintainer="Peter Hamilton <[email protected]>" \
description="ROM-LDAP with Rails"

RUN apk add --no-cache --no-progress \
build-base \
openldap-clients \
sqlite-dev \
tzdata

WORKDIR /usr/app

VOLUME /usr/app

EXPOSE 3000

COPY docker-entrypoint.sh /

RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
version: '2.4'


# https://docs.docker.com/compose/networking/#use-a-pre-existing-network
# $ docker network ls
networks:
default:
external:
name: docker_rom-ldap-network


services:
rom-ldap-rails:
container_name: rom_ldap_rails
build:
context: .
volumes:
- .:/usr/app
- ./tmp/bundler:/usr/local/bundle
ports:
- 3002:3000
environment:
- TZ
- LOCALE
- LDAPURI=ldap://cn=admin,dc=rom,dc=ldap:topsecret@openldap
- RAILS_ENV=development
command: rails server
tty: true
stdin_open: true
networks:
- default
15 changes: 15 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

set -e

echo "Ruby version:"
ruby --version

echo "Installing ruby gems:"
gem install bundler --no-document
bundle check || bundle install

echo "Create and migrate database:"
bundle exec rake db:migrate

exec bundle exec "$@"

0 comments on commit f26cc0b

Please sign in to comment.