diff --git a/.github/workflows/deploy-server.yml b/.github/workflows/deploy-server.yml index 1ed88bf9a8..234e944386 100644 --- a/.github/workflows/deploy-server.yml +++ b/.github/workflows/deploy-server.yml @@ -9,7 +9,7 @@ env: IMAGE_NAME: ${{ github.repository }} BUILD_DIR: build-${{ github.sha }} SERVER_BINARY_NAME: ambient-${{ github.sha }} - CANARY_SERVER_BINARY_NAME: ambient-0.3.0-dev + CANARY_SERVER_BINARY_NAME: ambient-0.3.1-dev jobs: build-and-push: @@ -45,7 +45,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: - file: slim-release.Dockerfile + file: Dockerfile context: . push: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} tags: ${{ steps.meta.outputs.tags }} diff --git a/Dockerfile b/Dockerfile index 50c4efd541..36d99e08de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,25 @@ -# Basic Dockerfile to build and run the server in a Linux environment. -# The official Rust base Docker image uses Debian. -FROM rust:1.70.0 -WORKDIR /app +# Instructions (replace "/path/to/your/project" with path to your project): +# 1. Build the image: docker build -f Dockerfile -t ambient . +# 2. Run the image: docker run -p 8999:8999/tcp -p 9000:9000/udp -v /path/to/your/project:/app/project ambient +# 3. Run `ambient join` locally to connect to the server +FROM rust:1.73-bullseye AS builder RUN apt-get update && \ apt-get install -y \ zip build-essential cmake pkg-config \ libfontconfig1-dev clang libasound2-dev ninja-build \ - libxcb-xfixes0-dev mesa-vulkan-drivers \ No newline at end of file + libxcb-xfixes0-dev mesa-vulkan-drivers +ADD . /build +WORKDIR /build +RUN cargo build --release --no-default-features --features production +RUN strip target/release/ambient + +FROM rust:1.73-bullseye +RUN apt-get update && \ + apt-get install -y \ + ca-certificates libasound2 +RUN rustup toolchain install stable +RUN rustup target add --toolchain stable wasm32-wasi +WORKDIR /app +COPY --from=builder /build/target/release/ambient ./ +CMD [ "./ambient", "serve", "--public-host", "localhost", "--release", "project" ] diff --git a/app/Cargo.toml b/app/Cargo.toml index ab1c81420f..4d545863bb 100644 --- a/app/Cargo.toml +++ b/app/Cargo.toml @@ -74,8 +74,7 @@ rusty-hook = "^0.11.2" [features] no_bundled_certs = [] default = ["tls-webpki-roots"] -slim = ["stackdriver"] -production = ["assimp"] +production = ["assimp", "stackdriver"] profile = ["ambient_app/profile"] assimp = ["ambient_model_import/russimp"] stackdriver = ["tracing-stackdriver"] diff --git a/slim-release.Dockerfile b/slim-release.Dockerfile deleted file mode 100644 index ff69ca2b9b..0000000000 --- a/slim-release.Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# Instructions (replace "guest/rust/packages/games/minigolf" with your project): -# 1. Build the image: docker build -f slim-release.Dockerfile -t ambient . -# 2. Run the image: docker run -p 8999:8999/tcp -p 9000:9000/udp -v `pwd`/guest/rust/packages/games/minigolf:/app/project ambient -# Note: the project has to be built (`ambient build guest/rust/packages/games/minigolf`) -# 3. Run `ambient join` locally to connect to the server - -FROM rust:1.70-bullseye AS builder -RUN apt-get update && \ - apt-get install -y \ - zip build-essential cmake pkg-config \ - libfontconfig1-dev clang libasound2-dev ninja-build \ - libxcb-xfixes0-dev mesa-vulkan-drivers -ADD . /build -WORKDIR /build -RUN cargo build --release --no-default-features --features slim -RUN strip target/release/ambient - -FROM debian:bullseye-slim -RUN apt-get update && \ - apt-get install -y \ - libasound2 -WORKDIR /app -COPY --from=builder /build/target/release/ambient ./ -CMD [ "./ambient", "serve", "--public-host", "localhost", "--no-build", "project" ]