Skip to content

Latest commit

 

History

History

api-server

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Running app in standalone container

  1. Build and run image.

     docker build --no-cache -t eyeezzi/horus-api-server .
     docker run -d --env-file=.env -p 5000:80 eyeezzi/horus-api-server
    

    Note: The server runs on port 80, but we expose it as 5000 on the host in order to avoid privilege issues with binding to low number ports. Knowledge bit: port-mapping cannot be set in dockerfile.

  2. View the logs generated by the app

     docker ps
     docker logs -f <container-name>
    
     # From another terminal on the host machine, test the server
     curl http://localhost:5000/api/v1/tokens
    

Dev Notes

To quickly test a container

docker build -t <image-name> --no-cache . \
    && docker run -it -v $(pwd)/src:/usr/src/app <imgage-name> sh

docker build -t api-server --no-cache . \
    && docker run -it -v $(pwd)/src:/usr/src/app api-server sh

The -v flag maps host absolute path to container absolute path.