Skip to content

Commit 7fd3597

Browse files
author
Max Dymond
committed
Switch rust image to rust:1-alpine3.18 as it's better maintained.
Signed-off-by: Max Dymond <max.dymond@microsoft.com>
1 parent 9f04ec5 commit 7fd3597

5 files changed

Lines changed: 34 additions & 4 deletions

File tree

.devcontainer/Dockerfile.alpine

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM rust:1-alpine3.18
2+
3+
ENV CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
4+
5+
RUN apk update && \
6+
apk add bash musl-dev shadow && \
7+
# Add a user for floki using the shadow utils
8+
useradd -Um -s /bin/bash floki
9+
10+
USER floki

.devcontainer/devcontainer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "floki",
3+
"build": { "dockerfile": "Dockerfile.alpine" },
4+
"remoteUser": "floki"
5+
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Status: Available for use
2121
- Add `toml` function to tera templating engine so that floki templates
2222
can use `toml(file="<filepath>")` in order to load values.
2323
- Add `floki render` to print out the rendered configuration template.
24+
- Switch rust image to `rust:1-alpine3.18` as it's better maintained.
2425

2526
### Fixed
2627

build.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,15 @@ echo "Starting release build for ${LABEL}"
2020
if [ ${OS_ID} = "linux" ]
2121
then
2222
echo "Building statically linked linux binary"
23-
docker run --rm -v $(pwd):/home/rust/src -w /home/rust/src ekidd/rust-musl-builder \
24-
sh -c 'sudo chown -R rust:rust . && cargo build --release && cp target/x86_64-unknown-linux-musl/release/floki .'
23+
docker build -f .devcontainer/Dockerfile.alpine -t flokirust .
24+
25+
docker run --rm -v $(pwd):/src -w /src flokirust \
26+
sh -c 'cargo build --release && cp target/x86_64-unknown-linux-musl/release/floki .'
2527
sudo chown -R $(id -u):$(id -g) .
28+
29+
# Check that it's statically compiled!
30+
ldd floki
31+
2632
tar -cvzf floki-${LABEL}.tar.gz floki
2733

2834
else

floki.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
image: ekidd/rust-musl-builder
2-
mount: /home/rust/src
1+
image:
2+
build:
3+
name: flokirust
4+
dockerfile: .devcontainer/Dockerfile.alpine
5+
context: .
6+
7+
volumes:
8+
alpine-cargo-registry:
9+
mount: /usr/local/cargo/registry
10+
311
forward_ssh_agent: true
412
shell: bash

0 commit comments

Comments
 (0)