ci(choco): fix chocolatey docker build (#903)

Signed-off-by: hackercat <me@hackerc.at>
This commit is contained in:
Ryan 2021-11-24 18:27:38 +01:00 committed by GitHub
parent 8ad6c07083
commit 6ebcac3771
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 27 deletions

View File

@ -1,36 +1,19 @@
# choco supports only Mono 5.20.x
# https://github.com/chocolatey/choco#prerequisites
FROM mono:5.20 as builder
# 0.10.15 with newer Mono is failing as it's dependent on Mono Profile 4.0 which has been deprecated
# http://www.mono-project.com/docs/about-mono/releases/4.0.0/#dropped-support-for-old-frameworks
# Alternative to consider, use git repository and reset to specific tag/hash
ARG CHOCOVERSION=0.10.16-beta
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y wget tar gzip
WORKDIR /usr/local/src
RUN wget "https://github.com/chocolatey/choco/archive/${CHOCOVERSION}.tar.gz"
RUN tar -xzf "${CHOCOVERSION}.tar.gz"
RUN mv "choco-${CHOCOVERSION}" choco
WORKDIR /usr/local/src/choco
RUN chmod +x build.sh zip.sh
RUN ./build.sh -v
FROM alpine:latest
COPY --from=builder /usr/local/src/choco/build_output/chocolatey /opt/chocolatey
ARG CHOCOVERSION=0.11.3
RUN apk add --no-cache bash
RUN apk --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing add mono-dev \
&& apk --update --no-cache add -t build-dependencies ca-certificates \
RUN apk add --no-cache bash ca-certificates \
&& apk --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing add mono-dev \
&& cert-sync /etc/ssl/certs/ca-certificates.crt \
&& wget "https://github.com/chocolatey/choco/archive/${CHOCOVERSION}.tar.gz" \
&& tar -xzf "${CHOCOVERSION}.tar.gz" \
&& mv "choco-${CHOCOVERSION}" /opt/chocolatey \
&& chmod +x build.sh zip.sh \
&& ./build.sh -v \
&& ln -sf /opt /opt/chocolatey/opt \
&& mkdir -p /opt/chocolatey/lib \
&& apk del build-dependencies \
&& apk del ca-certificates \
&& rm -rf /var/cache/apk/*
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -3,7 +3,7 @@
set -e
function choco {
mono /opt/chocolatey/choco.exe "$@" --allow-unofficial --nocolor
mono /opt/chocolatey/code_drop/chocolatey/choco.exe "$@" --allow-unofficial --nocolor
}
function get_version {