Skip to content

Commit dec1a4d

Browse files
author
Angela Guette
committed
docker files
updating dockerfiles
1 parent 794be97 commit dec1a4d

File tree

4 files changed

+40
-12
lines changed

4 files changed

+40
-12
lines changed

Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM ruby:2.5
2+
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
3+
RUN mkdir /app
4+
WORKDIR /app
5+
COPY Gemfile /app/Gemfile
6+
COPY Gemfile.lock /app/Gemfile.lock
7+
RUN bundle install
8+
COPY . /app
9+
EXPOSE 3000
10+
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]

README.md

+2-12
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,20 @@ Short a url given.
66

77
## Setup
88

9-
```
10-
git clone [email protected]:angela4713/content-indexer.git
11-
```
12-
13-
## Run bundle
14-
15-
```
16-
bundle install
17-
```
18-
199
## Tests
2010

2111
Run all the tests
2212

2313
```
24-
bundle exec rspec
14+
docker-compose run app rake spec
2515
```
2616

2717
## Usage
2818

2919
Run the application
3020

3121
```
32-
rails s
22+
docker run -p 4000:80 angela4713/url-shortener_app:part1
3323
```
3424

3525
## Methods

config/database.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
default: &default
1818
adapter: postgresql
1919
encoding: unicode
20+
host: db
2021
# For details on connection pooling, see Rails configuration guide
2122
# http://guides.rubyonrails.org/configuring.html#database-pooling
2223
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
24+
username: postgres
25+
port: 5432
2326

2427
development:
2528
<<: *default

docker-compose.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: '3'
2+
services:
3+
db:
4+
image: postgres
5+
volumes:
6+
- ./tmp/db:/var/lib/postgresql/data
7+
ports:
8+
- "5432:5432"
9+
networks:
10+
- app_net
11+
app:
12+
build: .
13+
command: rails server -p 3000 -b '0.0.0.0'
14+
volumes:
15+
- .:/app
16+
ports:
17+
- "3000:3000"
18+
depends_on:
19+
- db
20+
links:
21+
- db
22+
networks:
23+
- app_net
24+
networks:
25+
app_net:

0 commit comments

Comments
 (0)