mirror of
https://github.com/static-web-server/static-web-server.git
synced 2026-01-25 05:06:33 +00:00
refactor: prefer dynamically-linked binaries for Debian Docker images (#588)
* refactor: prefer dynamically-linked binaries for debian docker images * fix: disable dynamically-linked binary execution tests As dynamically-linked binaries can not be executed for obvious reasons * docs: improve os/arch section
This commit is contained in:
16
.github/workflows/release.docker.devel.yml
vendored
16
.github/workflows/release.docker.devel.yml
vendored
@@ -1,6 +1,15 @@
|
||||
name: release-docker-devel
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- .github/workflows/release.docker.devel.yml
|
||||
- .cargo/config.toml
|
||||
- Cargo.lock
|
||||
- Cargo.toml
|
||||
- src/**
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@@ -36,6 +45,10 @@ jobs:
|
||||
arch: linux/amd64
|
||||
rust: stable
|
||||
target: x86_64-unknown-linux-musl
|
||||
- build: linux-gnu
|
||||
arch: linux/amd64
|
||||
rust: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
|
||||
outputs:
|
||||
target: ${{ steps.target.outputs.target }}
|
||||
@@ -118,7 +131,8 @@ jobs:
|
||||
path: ${{ env.TARGET_DIR }}/${{ matrix.target }}/release
|
||||
key: cache-${{ github.sha }}-${{ matrix.target }}
|
||||
- name: Copy binary
|
||||
run: cp ${{ env.TARGET_DIR }}/${{ matrix.target }}/release/static-web-server ./docker/devel/
|
||||
run: |
|
||||
cp ${{ env.TARGET_DIR }}/${{ matrix.target }}/release/static-web-server ./docker/devel/
|
||||
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@v3
|
||||
|
||||
14
Makefile
14
Makefile
@@ -130,8 +130,8 @@ docker.image.alpine:
|
||||
.PHONY: docker.image.alpine
|
||||
|
||||
docker.image.debian:
|
||||
@echo "Creating development Docker Alpine image..."
|
||||
@cp -frp ./target/x86_64-unknown-linux-musl/release/static-web-server ./docker/devel/
|
||||
@echo "Creating development Docker Debian image..."
|
||||
@cp -frp ./target/release/static-web-server ./docker/devel/
|
||||
@docker build \
|
||||
--platform="linux/x86_64" \
|
||||
--network="host" \
|
||||
@@ -139,6 +139,16 @@ docker.image.debian:
|
||||
-t joseluisq/${PKG_NAME}:devel-debian . --pull=true
|
||||
.PHONY: docker.image.debian
|
||||
|
||||
buildx.image.debian:
|
||||
docker buildx build \
|
||||
--platform="linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x" \
|
||||
--network="host" \
|
||||
--build-arg SERVER_VERSION=2.39.0 \
|
||||
--rm=true -f ./docker/debian/Dockerfile \
|
||||
-t joseluisq/${PKG_NAME}:devel-debian . --pull=true
|
||||
# --push \
|
||||
.PHONY: buildx.image.debian
|
||||
|
||||
docker.image.all:
|
||||
@make docker.image
|
||||
@make docker.image.alpine
|
||||
|
||||
@@ -15,11 +15,13 @@ RUN set -eux \
|
||||
|
||||
RUN set -ex \
|
||||
&& case "$TARGETPLATFORM" in \
|
||||
"linux/amd64") target='x86_64-unknown-linux-musl' ;; \
|
||||
"linux/arm64") target='aarch64-unknown-linux-musl' ;; \
|
||||
"linux/386") target='i686-unknown-linux-musl' ;; \
|
||||
"linux/amd64") target='x86_64-unknown-linux-gnu' ;; \
|
||||
"linux/arm64") target='aarch64-unknown-linux-gnu' ;; \
|
||||
"linux/386") target='i686-unknown-linux-gnu' ;; \
|
||||
# TODO: linux/arm/v7 will use 'gnueabihf' instead of 'musleabihf' binary once available \
|
||||
# "linux/arm/v7") target='armv7-unknown-linux-gnueabihf' ;; \
|
||||
"linux/arm/v7") target='armv7-unknown-linux-musleabihf' ;; \
|
||||
"linux/arm/v6") target='arm-unknown-linux-musleabihf' ;; \
|
||||
"linux/arm/v6") target='arm-unknown-linux-gnueabihf' ;; \
|
||||
"linux/ppc64le") target='powerpc64le-unknown-linux-gnu' ;; \
|
||||
"linux/s390x") target='s390x-unknown-linux-gnu' ;; \
|
||||
*) echo >&2 "error: unsupported $TARGETPLATFORM architecture"; exit 1 ;; \
|
||||
@@ -37,14 +39,7 @@ RUN set -ex \
|
||||
&& uname -a \
|
||||
&& cat /etc/os-release \
|
||||
&& echo VERSION_NUMBER=$(cat /etc/debian_version) \
|
||||
&& case "$TARGETPLATFORM" in \
|
||||
**ppc64*|*s390x*) \
|
||||
echo "warn: can not run sws binary on $TARGETPLATFORM architecture" ;; \
|
||||
*) \
|
||||
static-web-server --version; \
|
||||
static-web-server --help; \
|
||||
;; \
|
||||
esac \
|
||||
&& echo TARGET_PLATFORM=$TARGETPLATFORM \
|
||||
&& file /usr/local/bin/static-web-server \
|
||||
&& true
|
||||
|
||||
|
||||
@@ -18,8 +18,11 @@ All Docker images are [Multi-Arch](https://www.docker.com/blog/how-to-rapidly-bu
|
||||
- `linux/ppc64le` (Debian only)
|
||||
- `linux/s390x` (Debian only)
|
||||
|
||||
!!! tip "SWS statically-linked binary"
|
||||
All the Docker images use the SWS statically-linked binary, meaning that the binary is highly optimized, performant, and dependency-free thanks to [musl libc](https://www.musl-libc.org/).
|
||||
!!! tip "`Scratch` and `Alpine` images use statically-linked binaries"
|
||||
`Scratch` and `Alpine` based Docker images use a statically-linked binary that is portable, performant and dependency-free thanks to [musl libc](https://www.musl-libc.org/), keeping containers as lean as possible.
|
||||
|
||||
!!! tip "`Debian` images use dynamically-linked binaries"
|
||||
`Debian` based Docker images use SWS dynamically-linked binaries, making containers highly optimized, performant and resource-efficient.
|
||||
|
||||
## Rootless
|
||||
|
||||
|
||||
Reference in New Issue
Block a user