Skip to content

Commit

Permalink
Merge pull request #34 from udacity/claudio/feat/FIN-459_PIE-1157_Doc…
Browse files Browse the repository at this point in the history
…ker_USER_directive

FIN-459 - PIE-1157 - Implement Docker Container Best Practices
  • Loading branch information
claudiomll authored Feb 12, 2024
2 parents 828b0ee + 2eeeb7d commit 55d43a1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ RUN bundle config --local set without 'development test' \
&& bundle config --local deployment true \
&& bundle install --jobs 20 --retry 5

RUN adduser --disabled-password -u 1001 appuser \
&& chown -R appuser:appuser /app

USER appuser:appuser
ENV RACK_ENV production
CMD ["bundle", "exec", "ruby", "fomotograph.rb", "-p", "4567"]
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ export
all: build

test:
@echo "Nothing to test..."
docker-compose up -d --build && sleep 10
# docker-compose exec test curl http://app:4567/healthcheck
docker-compose exec test curl http://app:4567/products.json -o /tmp/test1
docker-compose exec test jq '.' /tmp/test1
docker-compose exec test curl http://app:4567/erasurez -o /tmp/test2
docker-compose exec test jq '.' /tmp/test2
docker-compose down

build:
docker build -t $(SERVICE_NAME) .
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'
services:
app:
build:
context: .
ports:
- "4567:4567"
test:
image: cimg/base:2024.01
command: sleep 1000

0 comments on commit 55d43a1

Please sign in to comment.