Skip to content

Commit 2479e59

Browse files
committed
Docker updates
1 parent d6ac1b9 commit 2479e59

File tree

3 files changed

+41
-18
lines changed

3 files changed

+41
-18
lines changed

.dockerignore

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
*
2-
!target/aarch64-unknown-linux-musl/release/stylus
3-
!target/arm-unknown-linux-musleabi/release/stylus
4-
!target/arm-unknown-linux-musleabihf/release/stylus
5-
!target/x86_64-unknown-linux-musl/release/stylus

build.sh

+26-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
#!/bin/bash
22
set -xeuf -o pipefail
3-
cargo clean
4-
cargo install cross
5-
cross build --release --target arm-unknown-linux-musleabi
6-
cross build --release --target arm-unknown-linux-musleabihf
7-
cross build --release --target aarch64-unknown-linux-musl
8-
cross build --release --target x86_64-unknown-linux-musl
9-
10-
docker build --no-cache --platform linux/arm/v6 --build-arg BUILDPLATFORM=arm32v6 --build-arg RUSTPLATFORM=arm-unknown-linux-musleabi -t mmastrac/stylus:latest-arm -f docker/Dockerfile .
11-
docker build --no-cache --platform linux/arm64 --build-arg BUILDPLATFORM=arm64v8 --build-arg RUSTPLATFORM=aarch64-unknown-linux-musl -t mmastrac/stylus:latest-arm64 -f docker/Dockerfile .
12-
docker build --no-cache --platform linux/amd64 --build-arg BUILDPLATFORM=amd64 --build-arg RUSTPLATFORM=x86_64-unknown-linux-musl -t mmastrac/stylus:latest-x86_64 -f docker/Dockerfile .
3+
if [ "$#" != "1" ]; then
4+
echo "Usage: $0 <version>"
5+
exit 1
6+
fi
7+
8+
VERSION="$1"
9+
echo "Building Docker container for $VERSION..."
10+
11+
docker build --no-cache --platform linux/arm/v6 \
12+
--build-arg VERSION=$VERSION \
13+
--build-arg BINARYPLATFORM=linux_arm \
14+
--build-arg BUILDPLATFORM=arm32v6 \
15+
--build-arg RUSTPLATFORM=arm-unknown-linux-musleabi \
16+
-t mmastrac/stylus:latest-arm -f docker/Dockerfile .
17+
docker build --no-cache --platform linux/arm64 \
18+
--build-arg VERSION=$VERSION \
19+
--build-arg BINARYPLATFORM=linux_arm64 \
20+
--build-arg BUILDPLATFORM=arm64v8 \
21+
--build-arg RUSTPLATFORM=aarch64-unknown-linux-musl \
22+
-t mmastrac/stylus:latest-arm64 -f docker/Dockerfile .
23+
docker build --no-cache --platform linux/amd64 \
24+
--build-arg VERSION=$VERSION \
25+
--build-arg BINARYPLATFORM=linux_amd64 \
26+
--build-arg BUILDPLATFORM=amd64 \
27+
--build-arg RUSTPLATFORM=x86_64-unknown-linux-musl \
28+
-t mmastrac/stylus:latest-x86_64 -f docker/Dockerfile .
1329

1430
docker push mmastrac/stylus:latest-arm
1531
docker push mmastrac/stylus:latest-arm64
@@ -28,8 +44,6 @@ docker manifest annotate --os linux --arch amd64 mmastrac/stylus:latest mmastrac
2844

2945
docker manifest push mmastrac/stylus:latest
3046

31-
VERSION=`cargo run -- --version | cut -d' ' -f2`
32-
3347
rm -rf ~/.docker/manifests/docker.io_mmastrac_stylus-$VERSION
3448
docker manifest create mmastrac/stylus:$VERSION \
3549
mmastrac/stylus:latest-arm \

docker/Dockerfile

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
ARG BUILDPLATFORM
22
FROM ${BUILDPLATFORM}/alpine:latest
3+
ARG VERSION
34
ARG RUSTPLATFORM
5+
ARG BINARYPLATFORM
6+
ARG PUPVERSION=0.4.0
47
VOLUME /srv
58
EXPOSE 8000/tcp
6-
# Our useful set of tools
9+
10+
# Our useful set of tools from the Alpine repository
711
RUN apk update && apk upgrade && apk add jq curl netcat-openbsd bash openssh-client net-snmp-tools tini
8-
COPY target/${RUSTPLATFORM}/release/stylus /usr/local/bin/stylus
12+
13+
# Install pup via curl
14+
RUN curl -fL https://github.com/ericchiang/pup/releases/download/v${PUPVERSION}/pup_v${PUPVERSION}_${BINARYPLATFORM}.zip \
15+
| unzip -p - > /usr/local/bin/pup \
16+
&& chmod a+x /usr/local/bin/pup
17+
18+
# Install stylus via curl
19+
RUN curl -fL https://github.com/mmastrac/stylus/releases/download/${VERSION}/stylus_${BINARYPLATFORM} > /usr/local/bin/stylus \
20+
&& chmod a+x /usr/local/bin/stylus
21+
922
ENV FORCE_CONTAINER_LISTEN_ADDR=0.0.0.0 FORCE_CONTAINER_PATH=/srv/config.yaml FORCE_CONTAINER_PORT=8000
1023
CMD []
1124

0 commit comments

Comments
 (0)