Last active
March 14, 2025 07:10
-
-
Save schmichri/2c7b12edb62845249de601c0c3c46f7f to your computer and use it in GitHub Desktop.
Build Angular Site with Docker. Extracts version from package.json and injects it in the Dockerfile https://www.license-token.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # fetch-depth here to ensure the timestamps are readable | |
| fetch-depth: 0 | |
| - name: Extract version from package.json | |
| id: extract_version | |
| run: | | |
| IMAGE_TAG=$(node -p "require('./package.json').version") | |
| echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV | |
| echo "Version to be used as tag: $IMAGE_TAG" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Private Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build the Docker image | |
| run: | | |
| docker build -t license-token-website:$IMAGE_TAG . | |
| docker push license-token-website:$IMAGE_TAG | |
| - name: Inspect | |
| run: | | |
| docker image inspect license-token-website:$IMAGE_TAG |
Author
Author
handles the Dockefile https://gist.github.com/schmichri/9679486f6bf41dee0cfdb0eaafe826da
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
package.json bumped by https://gist.github.com/schmichri/724937834313af1e5113a01b66591e46