Skip to content

Latest commit

 

History

History
47 lines (29 loc) · 1.07 KB

File metadata and controls

47 lines (29 loc) · 1.07 KB

dockerized-gitversion

What is GitVersion

GitVersion is a tool to help you achieve Semantic Versioning on your project.

How to use this image as a part of multi stage docker build

This image will run GitVersion Command Line tool. It expects the git rempository to be bound at /src

Step 1

Add the following as the first stage in your multistage docker file

FROM aakashkhanna/dockerized-gitversion:latest as gitversion

Step 2

Add the following in the file stage of your multistage docker file to extract the version.txt file

COPY --from=gitversion /repo/version.txt /project/

Sample DockerFile

FROM aakashkhanna/dockerized-gitversion:latest as gitversion

FROM python:3.8

COPY --from=gitversion /repo/version.txt /project/


RUN pip install poetry \
    && poetry install \
    && version=`cat version.txt` \
    && version=`sed 's/-/+/1' <<< $version` \
    && echo "Version: ${version}" \
    && poetry version $version \
    && poetry build