# https://dev.to/sergeyzenchenko/actix-web-in-docker-how-to-build-small-and-secure-images-2mjd # apply environment variables in the Dockerfile: https://stackoverflow.com/questions/39597925/how-do-i-set-environment-variables-during-the-build-in-docker FROM rust:1.64.0 as build ENV PKG_CONFIG_ALLOW_CROSS=1 WORKDIR /usr/src/x-server-stats COPY . . RUN cargo install --path . FROM gcr.io/distroless/cc-debian11 COPY --from=build /usr/local/cargo/bin/x-server-stats /usr/local/bin/x-server-stats ENV SERVER_ADDR=0.0.0.0:8082 ENV PG__USER=PG_USERNAME ENV PG__PASSWORD=PG_PASSWORD ENV PG__HOST=PG_HOST_URL ENV PG__PORT=5432 ENV PG__DBNAME=PG_DB_NAME ENV PG__POOL__MAX_SIZE=20 ENV BASE_ADDR=http://0.0.0.0:8082 EXPOSE 8082 CMD ["./usr/local/bin/x-server-stats"]