diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..2c1f651 --- /dev/null +++ b/.env.sample @@ -0,0 +1,2 @@ +ACCUWHEATHER_API_ID=######## +PATH_TO_CITIES="/share/cities.json" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3cbdfb5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM rust AS build +WORKDIR /code +COPY ./code . +RUN cargo install --path . + +FROM debian:buster-slim +COPY --from=build /usr/local/cargo/bin/clima /usr/local/bin/clima +RUN apt-get update && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/* +ENV ACCUWHEATHER_API_ID "1" +ENV PATH_TO_CITIES "/share/cities.json" +CMD [ "sh", "-c", "/usr/local/bin/clima $ACCUWHEATHER_API_ID $PATH_TO_CITIES" ] diff --git a/README.md b/README.md index 319782c..d37f9f5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ # Call ``` -app ACCUWHEATHER_API_ID PATH_TO_CITIES.txt +docker compose up +``` + +# Compile / Build + +``` +docker compose build +``` + +# Rebuild + +``` +docker compose down --rmi all; docker compose build ``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..dfca0a7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' + +services: + app: + image: rust + build: . + env_file: + - .env + volumes: + - ./cities.json:/share/cities.json