fix Dockerfile.zefie, add docker.sh helper
This commit is contained in:
1 parent
dc8b55b2b7
commit
31aede5014
2 files changed
+63
-5
No files matched your search
+7
-5
@@ -159,10 +159,10 @@ RUN wget "https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL
|
||||
|
||||
# --- ncurses ---
|
||||
ENV NCURSES_VERSION=6.6
|
||||
RUN wget "https://ftp.gnu.org/gnu/ncurses/ncurses-${NCURSES_VERSION}.tar.gz" -O "ncurses-${NCURSES_VERSION}.tar.gz" && \
|
||||
tar -zxf "ncurses-${NCURSES_VERSION}.tar.gz" && \
|
||||
rm -f "ncurses-${NCURSES_VERSION}.tar.gz" && \
|
||||
ENV NCURSES_SNAPSHOT_COMMIT=26ceb3cbd343d2e503ca21d90077143a12727c22
|
||||
RUN git clone --depth=1 --revision "${NCURSES_SNAPSHOT_COMMIT}" "https://github.com/ThomasDickey/ncurses-snapshots.git" "ncurses-${NCURSES_VERSION}" && \
|
||||
cd "ncurses-${NCURSES_VERSION}" && \
|
||||
sed -i '1i #include <wchar.h>' ncurses/build.priv.h && \
|
||||
${TOOLCHAIN_PREFIX}/wrapper.sh \
|
||||
--with-fallbacks=ansi,xterm,xterm-256color \
|
||||
--disable-database \
|
||||
@@ -294,7 +294,7 @@ RUN wget "https://downloads.xiph.org/releases/vorbis/libvorbis-${LIBVORBIS_VERSI
|
||||
tar -Jxf "libvorbis-${LIBVORBIS_VERSION}.tar.xz" && \
|
||||
rm -f "libvorbis-${LIBVORBIS_VERSION}.tar.xz" && \
|
||||
cd "libvorbis-${LIBVORBIS_VERSION}" && \
|
||||
${TOOLCHAIN_PREFIX}/wrapper.sh --cmake -DBUILD_SHARED_LIBS=OFF && \
|
||||
${TOOLCHAIN_PREFIX}/wrapper.sh --cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5 && \
|
||||
cd /src && \
|
||||
rm -rf "libvorbis-${LIBVORBIS_VERSION}" build-libvorbis && \
|
||||
for f in $TARGET_TRIPLETS; do rm -rf "${TOOLCHAIN_PREFIX}/${f}/share/"{doc,man,info,examples}; done
|
||||
@@ -381,6 +381,7 @@ RUN wget "https://github.com/libsndfile/libsndfile/releases/download/${LIBSNDFIL
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DBUILD_PROGRAMS=OFF \
|
||||
-DBUILD_EXAMPLES=OFF \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-DCMAKE_C_FLAGS="-DFLAC__NO_DLL=1" && \
|
||||
cd /src && \
|
||||
rm -rf "libsndfile-${LIBSNDFILE_VERSION}" build-sndfile && \
|
||||
@@ -396,6 +397,7 @@ RUN wget "https://github.com/libsndfile/libsamplerate/releases/download/${LIBSAM
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DLIBSAMPLERATE_EXAMPLES=OFF \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
-DCMAKE_C_FLAGS="-DFLAC__NO_DLL=1" && \
|
||||
cd /src && \
|
||||
rm -rf "libsamplerate-${LIBSAMPLERATE_VERSION}" build-samplerate && \
|
||||
@@ -473,4 +475,4 @@ RUN wget "https://sourceforge.net/projects/freeglut/files/freeglut/${FREEGLUT_VE
|
||||
|
||||
USER ubuntu
|
||||
WORKDIR /src
|
||||
CMD ["/bin/bash"]
|
||||
CMD ["/bin/bash"]
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DOCKER_IMAGE="zefie/llvm-mingw"
|
||||
CURDIR="$(realpath "$(dirname "${0}")")"
|
||||
|
||||
get_latest() {
|
||||
# Find all tags for ${DOCKER_IMAGE}, sort by creation timestamp (descending), return the newest
|
||||
latest_image=$(docker images --format '{{.CreatedAt}}\t{{.Repository}}:{{.Tag}}' ${DOCKER_IMAGE} \
|
||||
| sort -r \
|
||||
| cut -f2- \
|
||||
| grep -v latest \
|
||||
| head -n 1)
|
||||
|
||||
if [[ -z "$latest_image" ]]; then
|
||||
echo "No images found for repository '${DOCKER_IMAGE}'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$latest_image"
|
||||
}
|
||||
|
||||
if [ "${1}" == "build" ]; then
|
||||
THETAG=$(date +%Y%m%d)
|
||||
cd "$(realpath "$(dirname "${0}")")"
|
||||
docker buildx build --tag "${DOCKER_IMAGE}:${THETAG}" .
|
||||
elif [ "${1}" == "mklatest" ]; then
|
||||
LATEST=$(get_latest)
|
||||
if [ -z "${LATEST}" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
docker tag "${LATEST}" ${DOCKER_IMAGE}:latest
|
||||
echo "Set ${DOCKER_IMAGE}:latest to ${LATEST}"
|
||||
elif [ "${1}" == "run" ]; then
|
||||
shift
|
||||
IMAGE=$(get_latest)
|
||||
if [ -z "${IMAGE}" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
export EMBEDDED=1
|
||||
CMD=(docker run --rm -it "${IMAGE}" "${@}")
|
||||
echo "Executing ${CMD[@]}"
|
||||
"${CMD[@]}"
|
||||
elif [ "${1}" == "push" ]; then
|
||||
# push dated one first, then latest
|
||||
"${0}" mklatest
|
||||
IMAGE=$(get_latest)
|
||||
echo "Pushing ${IMAGE}"
|
||||
docker push "${IMAGE}"
|
||||
echo "Pushing ${DOCKER_IMAGE}:latest"
|
||||
docker push "${DOCKER_IMAGE}:latest"
|
||||
else
|
||||
echo "Usage: ${0} [build|run|mklatest]"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user