diff --git a/Dockerfile b/Dockerfile index a5603d2..c2d049c 100755 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,10 @@ FROM python:3.10 ENV PYTHONUNBUFFERED 1 +ARG AMADEUS_CLIENT_ID +ARG AMADEUS_CLIENT_SECRET +ARG AMADEUS_HOSTNAME + RUN mkdir /code WORKDIR /code diff --git a/Makefile b/Makefile deleted file mode 100755 index 998df9a..0000000 --- a/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -PORTS = -p 8000:8000 -ENV = \ - -e AMADEUS_CLIENT_ID=${AMADEUS_CLIENT_ID} \ - -e AMADEUS_CLIENT_SECRET=${AMADEUS_CLIENT_SECRET} \ - -e AMADEUS_HOSTNAME=${AMADEUS_HOSTNAME} - -NS ?= amadeus4dev -VERSION ?= latest - -IMAGE_NAME ?= hotel-booking -CONTAINER_NAME ?= hotel-booking -CONTAINER_INSTANCE ?= default - -build: Dockerfile - docker build -t $(NS)/$(IMAGE_NAME):$(VERSION) -f Dockerfile . - -run: - docker run --rm -i -t --name $(CONTAINER_NAME)-$(CONTAINER_INSTANCE) \ - $(PORTS) \ - $(ENV) \ - $(NS)/$(IMAGE_NAME):$(VERSION) - -start: - docker run -d --name $(CONTAINER_NAME)-$(CONTAINER_INSTANCE) \ - $(PORTS) \ - $(ENV) \ - $(NS)/$(IMAGE_NAME):$(VERSION) - -stop: - docker stop $(CONTAINER_NAME)-$(CONTAINER_INSTANCE) - -rm: - docker rm $(CONTAINER_NAME)-$(CONTAINER_INSTANCE) - -default: build - -.PHONY: build run start stop rm diff --git a/README.md b/README.md index 26f3ab7..79422ae 100755 --- a/README.md +++ b/README.md @@ -13,41 +13,27 @@ You also check out the [demo](https://hotel-booking-engine.azurewebsites.net/) a ## How to run the project via Docker (recommended) -Build the image from the Dockerfile. The following command will +First you need to add your environment variales in an `.env` file, such as ```sh -make +AMADEUS_CLIENT_ID=YOUR_API_KEY +AMADEUS_CLIENT_SECRET=YOUR_API_SECRET ``` -The container receives your API key/secret from the environment variables. -Before running the container, make sure your have your credentials correctly -set: +Build the image from the Dockerfile. The following command will ```sh -export AMADEUS_CLIENT_ID=YOUR_API_KEY -export AMADEUS_CLIENT_SECRET=YOUR_API_SECRET +podman build -t hotel-booking . ``` -Finally, start the container from the image: - -``` -make run +Then start the app +```sh +podman run --env-file .env -p 8000:8000 hotel-booking ``` -At this point you can open a browser and go to `https://0.0.0.0:8000`. -Note that it is also possible to run in detached mode so your terminal is still -usable: - -``` -make start -``` - -Stop the container with: +At this point you can open a browser and go to `https://0.0.0.0:8000`. -``` -make stop -``` ## How to run the project locally