add dev container and default ip
This commit is contained in:
parent
41955a7e21
commit
d352e7537c
3 changed files with 13 additions and 5 deletions
11
Dockerfile
11
Dockerfile
|
|
@ -1,11 +1,13 @@
|
||||||
FROM rust:alpine AS builder
|
FROM rust:alpine AS dev-container
|
||||||
|
|
||||||
|
RUN apk add --no-cache protobuf-dev git musl-dev lld openssl-dev openssl-libs-static
|
||||||
|
|
||||||
|
FROM dev-container as builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN apk add --no-cache protobuf-dev git musl-dev lld openssl-dev openssl-libs-static
|
|
||||||
|
|
||||||
RUN git submodule update --init --recursive
|
RUN git submodule update --init --recursive
|
||||||
|
|
||||||
RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 RUSTFLAGS="-C relocation-model=static -C linker=ld.lld" cargo test --target x86_64-unknown-linux-musl
|
RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 RUSTFLAGS="-C relocation-model=static -C linker=ld.lld" cargo test --target x86_64-unknown-linux-musl
|
||||||
|
|
@ -32,3 +34,6 @@ ENTRYPOINT ["/backend_server_secure"]
|
||||||
FROM scratch AS backend-secure
|
FROM scratch AS backend-secure
|
||||||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/backend_server_secure /backend_server_secure
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/backend_server_secure /backend_server_secure
|
||||||
ENTRYPOINT ["/backend_server_secure"]
|
ENTRYPOINT ["/backend_server_secure"]
|
||||||
|
|
||||||
|
# make sure the final output container is the dev container so that we can use it from the devcontainer.json
|
||||||
|
FROM final as dev-container
|
||||||
|
|
|
||||||
3
devcontainer.json
Normal file
3
devcontainer.json
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"build": { "dockerfile": "Dockerfile" }
|
||||||
|
}
|
||||||
|
|
@ -6,8 +6,8 @@ use crate::nex::account::Account;
|
||||||
pub static OWN_IP_PRIVATE: Lazy<Ipv4Addr> = Lazy::new(|| {
|
pub static OWN_IP_PRIVATE: Lazy<Ipv4Addr> = Lazy::new(|| {
|
||||||
env::var("SERVER_IP")
|
env::var("SERVER_IP")
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|s| s.parse().ok())
|
.map(|s| s.parse().expect("invalid ip address"))
|
||||||
.expect("SERVER_IP not specified")
|
.unwrap_or(Ipv4Addr::UNSPECIFIED)
|
||||||
});
|
});
|
||||||
|
|
||||||
pub static OWN_IP_PUBLIC: Lazy<Ipv4Addr> = Lazy::new(|| {
|
pub static OWN_IP_PUBLIC: Lazy<Ipv4Addr> = Lazy::new(|| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue