Skip to content

Commit

Permalink
chore: workflow updates (#17)
Browse files Browse the repository at this point in the history
- Pin base image digest
- Replace wget by curl
- Publish new image on each push to `main` branch
- Remove release workflow
- Update README
  • Loading branch information
bonddim authored Nov 9, 2024
1 parent dbb7962 commit 4a75328
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 58 deletions.
22 changes: 5 additions & 17 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":disableDependencyDashboard"
],
"extends": ["config:recommended", ":disableDependencyDashboard"],
"automerge": true,
"automergeStrategy": "squash",
"enabledManagers": [
"dockerfile",
"github-actions",
"custom.regex"
],
"enabledManagers": ["custom.regex", "dockerfile", "github-actions"],
"customManagers": [
{
"customType": "regex",
"description": "Update sqlcmd version",
"description": ["Update sqlcmd version"],
"datasourceTemplate": "github-releases",
"depNameTemplate": "microsoft/go-sqlcmd",
"fileMatch": [
"^Dockerfile$",
"^version$"
],
"matchStrings": [
"(?:ARG )?SQLCMD_VERSION=(?<currentValue>.+?)\\s"
]
"fileMatch": ["^Dockerfile$"],
"matchStrings": ["ARG SQLCMD_VERSION=(?<currentValue>.+?)\\s"]
}
]
}
8 changes: 3 additions & 5 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ name: Docker
on:
pull_request:
branches: [main]
release:
types: [published]
push:
branches: [main]

permissions:
packages: write
Expand All @@ -22,14 +22,12 @@ jobs:
- uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: ${{ github.event_name == 'release' }}
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
if: ${{ github.event_name == 'release' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
Expand All @@ -51,4 +49,4 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64,linux/s390x
provenance: false
push: ${{ github.event_name == 'release' }}
push: ${{ github.event_name == 'push' }}
27 changes: 0 additions & 27 deletions .github/workflows/release.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM --platform=${BUILDPLATFORM} alpine:3 AS tools
ARG SQLCMD_VERSION=v1.8.0
ARG TARGETARCH
RUN apk add jq --no-cache && \
wget -c -O - $(wget -q -O - https://api.github.com/repos/microsoft/go-sqlcmd/releases/tags/${SQLCMD_VERSION} \
| jq -r --arg arch "${TARGETARCH}" '.assets[] | select(.name | test(".*linux.*" + $arch + ".*")).browser_download_url' ) \
RUN apk add --update-cache --no-cache curl jq xz && \
curl -sSL $(curl -sSL "https://api.github.com/repos/microsoft/go-sqlcmd/releases/tags/${SQLCMD_VERSION}" | \
jq -r --arg arch "${TARGETARCH}" '.assets[] | select(.name | test(".*linux.*" + $arch + ".*")).browser_download_url') \
| tar -xj

FROM gcr.io/distroless/static:nonroot
FROM gcr.io/distroless/static:nonroot@sha256:3a03fc0826340c7deb82d4755ca391bef5adcedb8892e58412e1a6008199fa91
COPY --from=tools /sqlcmd /sqlcmd
USER nonroot:nonroot
ENTRYPOINT ["/sqlcmd"]
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# [go-sqlcmd](https://github.com/microsoft/go-sqlcmd) docker image

[![Docker](https://github.com/bonddim/go-sqlcmd/actions/workflows/docker.yaml/badge.svg?event=release)](https://github.com/bonddim/go-sqlcmd/actions/workflows/docker.yaml)
![Docker Image Size](https://img.shields.io/docker/image-size/bonddim/go-sqlcmd)
[![Docker Pulls](https://img.shields.io/docker/pulls/bonddim/go-sqlcmd)](https://hub.docker.com/r/bonddim/go-sqlcmd)
[![GitHub Release](https://img.shields.io/github/v/release/bonddim/go-sqlcmd)](https://github.com/bonddim/go-sqlcmd/releases/latest)
[docker-hub]: https://hub.docker.com/r/bonddim/go-sqlcmd
[![Docker](https://github.com/bonddim/go-sqlcmd/actions/workflows/docker.yaml/badge.svg)](https://github.com/bonddim/go-sqlcmd/actions/workflows/docker.yaml)
[![Docker Image Version](https://img.shields.io/docker/v/bonddim/go-sqlcmd)][docker-hub]
[![Docker Image Size](https://img.shields.io/docker/image-size/bonddim/go-sqlcmd)][docker-hub]
[![Docker Pulls](https://img.shields.io/docker/pulls/bonddim/go-sqlcmd)][docker-hub]
[![GitHub License](https://img.shields.io/github/license/bonddim/go-sqlcmd)](https://github.com/bonddim/go-sqlcmd?tab=MIT-1-ov-file)

## About
Expand Down
1 change: 0 additions & 1 deletion version

This file was deleted.

0 comments on commit 4a75328

Please sign in to comment.