FROM alpine:3.14
ARG TARGETPLATFORM
# Set by build-arg
ARG TAG=v2.2.3

# Strip out the prefix
ENV PLAT=${TARGETPLATFORM//"linux/"/} 

WORKDIR /code

ADD https://hub.cybercinch.nz/cybercinch/go-semantic-release/releases/download/${TAG}/go-semantic-release.linux_${PLAT}.zip /tmp
RUN apk add --no-cache unzip && \
    unzip -d /tmp /tmp/go-semantic-release.linux_${PLAT}.zip && \
    ls && \
    ls /tmp && \
    mv /tmp/go-semantic-release.linux_${PLAT} /usr/local/bin/go-semantic-release && \
    rm -f /tmp/go-semantic-release.linux_${PLAT}.zip

USER 1000

ENTRYPOINT [ "go-semantic-release" ]
