diff --git a/.github/workflows/build_docker_image.yaml b/.github/workflows/build_docker_image.yaml index 656eb3d..c1a110d 100644 --- a/.github/workflows/build_docker_image.yaml +++ b/.github/workflows/build_docker_image.yaml @@ -28,9 +28,16 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + + - name: read tags + run: | + echo "VERSION=0.0.4" >> $GITHUB_ENV + - name: debug run: | echo "TEST ${{ secrets.DOCKERHUB_USERNAME }} ${{ secrets.DOCKERHUB_TOKEN }} credentials" + echo "VERSION=${{ env.VERSION }}" + - name: Login to DockerHub XXXX uses: docker/login-action@v3 @@ -38,6 +45,7 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Docker meta id: docker_meta @@ -49,7 +57,7 @@ jobs: # tags: ${{ inputs.tag-rules }} tags: | latest - 0.0.3 + ${{ env.VERSION }} # - name: Build and push diff --git a/Dockerfile b/Dockerfile index 59799d6..393a4ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,16 @@ -from nginx:alpine +from alpine as build + +RUN apk add --no-cache sed +COPY app/ /app +RUN ls -alh /app +RUN echo "test" +RUN export version=$(cat /app/version.txt) && echo $version +RUN sed -i'' "s/--version--/$version/g" /app/index.html + + +from nginx:alpine as prod + + +COPY --from=build /app /usr/share/nginx/html -COPY app /usr/share/nginx/html \ No newline at end of file diff --git a/app/index.html b/app/index.html index 591870c..18a6e02 100644 --- a/app/index.html +++ b/app/index.html @@ -18,7 +18,7 @@