Added build & run docker scripts
This commit is contained in:
17
microservices/weather/.dockerignore
Normal file
17
microservices/weather/.dockerignore
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
debug/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
|
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||||
|
Cargo.lock
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# App settings
|
||||||
|
Settings.toml
|
||||||
9
microservices/weather/Dockerfile
Normal file
9
microservices/weather/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
FROM rust:1.61.0 as builder
|
||||||
|
# 2. Copy the files in your machine to the Docker image
|
||||||
|
COPY ./ ./
|
||||||
|
|
||||||
|
# Build your program for release
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
# Run the binary
|
||||||
|
CMD ["./target/release/test_weather_data"]
|
||||||
3
microservices/weather/build-docker.sh
Executable file
3
microservices/weather/build-docker.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
docker build . -t weather-microservice:latest
|
||||||
@@ -14,3 +14,5 @@ influx_db_token="xxx"
|
|||||||
latitude="xxx"
|
latitude="xxx"
|
||||||
longitude="xxx"
|
longitude="xxx"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
These settings can also be specified in the environment variables, when running in docker.
|
||||||
|
|||||||
0
microservices/weather/run-docker.sh
Executable file
0
microservices/weather/run-docker.sh
Executable file
Reference in New Issue
Block a user