1
0
mirror of https://github.com/actix/examples synced 2024-11-23 14:31:07 +01:00

build: update docker example to bookworm

This commit is contained in:
Rob Ede 2024-02-05 16:26:50 +00:00
parent a46b707c69
commit b6d60d89ab
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 10 additions and 9 deletions

View File

@ -3,7 +3,8 @@ name = "docker_sample"
version = "1.0.0" version = "1.0.0"
edition = "2021" edition = "2021"
# Do not use workspace deps as they won't work in docker context.
[dependencies] [dependencies]
actix-web.workspace = true actix-web = "4"
env_logger.workspace = true env_logger = "0.11"
log.workspace = true log = "0.4"

View File

@ -3,7 +3,7 @@
################# #################
## build stage ## ## build stage ##
################# #################
FROM rust:1-slim-bullseye AS builder FROM rust:1-slim-bookworm AS builder
WORKDIR /code WORKDIR /code
# Download crates-io index and fetch dependency code. # Download crates-io index and fetch dependency code.
@ -22,7 +22,7 @@ RUN cargo build --release
############### ###############
## run stage ## ## run stage ##
############### ###############
FROM debian:bullseye-slim FROM bitnami/minideb:bookworm
WORKDIR /app WORKDIR /app
# copy server binary from build stage # copy server binary from build stage

View File

@ -3,13 +3,13 @@
## Build image ## Build image
```shell ```shell
docker build -t docker_sample . docker build -t actix-docker .
``` ```
## Run built image ## Run built image
```shell ```shell
docker run -d -p 8080:8080 docker_sample docker run -d -p 8080:8080 actix-docker
# and the server should start instantly # and the server should start instantly
curl http://localhost:8080 curl http://localhost:8080
``` ```
@ -17,6 +17,6 @@ curl http://localhost:8080
## Running unit tests ## Running unit tests
```shell ```shell
docker build -t docker_sample:test . docker build -t actix-docker:test .
docker run --rm docker_sample:test docker run --rm actix-docker:test
``` ```