Add docker

This commit is contained in:
Tyler Perkins 2022-04-30 20:13:39 -04:00
parent 7e8f1e30b7
commit ad92a7ebba
2 changed files with 43 additions and 0 deletions

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM ubuntu:latest AS build
RUN apt-get update && apt-get install -y curl build-essential git libboost-all-dev
RUN curl https://github.com/CrowCpp/Crow/releases/download/v1.0%2B2/crow-v1.0+2.deb -o crow.deb -L
RUN apt-get purge -y curl
RUN apt install -y ./crow.deb
WORKDIR /work
COPY ./ ./
RUN make clean && make
FROM ubuntu:latest
#WORKDIR /opt/proc-api
COPY --from=build /work/bin/proc-api ./
ENV PORT="5000"
ENV NAME="proc-api"
ENV THREADS="2"
ENV AUTH=""
CMD ./proc-api -p $PORT -n $NAME -t $THREADS $(if [ -z $AUTH ]; then echo ""; else echo "-a $AUTH"; fi)

20
docker-compose.yml Normal file
View File

@ -0,0 +1,20 @@
# NOTE: This is a sample docker-compose for how you could set up your own set
# of containers
version: '3'
services:
proc-api_service:
image: proc-api
container_name: proc-api_service
restart: unless-stopped
ports:
- 5000:5000
- 6123:6123
environment:
- PORT=6123
- NAME="My Cool Service"
- THREADS=4
#-AUTH="./auth.txt"
#NOTE for auth to work, you will need to mount a volume with the authfile
#in it