Skip to content

Commit

Permalink
add docker image in GH packages
Browse files Browse the repository at this point in the history
This adds a Docker image to the GitHub packages of this repository. The image contains Python 3.10, Azure CLI, ODBC driver and Microsoft MS SQL tools. The image can then be used when running CI/CD.
  • Loading branch information
sdebruyn committed May 21, 2022
1 parent 8233443 commit 65720f7
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 30 deletions.
30 changes: 0 additions & 30 deletions .circleci/Dockerfile

This file was deleted.

26 changes: 26 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM python:3.10-bullseye

# Setup dependencies for pyodbc
RUN apt-get update && \
apt-get install -y unixodbc-dev unixodbc apt-transport-https curl lsb-release && \
rm -rf /var/lib/apt/lists/*

# enable Microsoft package repo
RUN curl -sL -o mspkgs.deb https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb && \
dpkg -i mspkgs.deb && \
rm -rf mspkgs.deb

# enable Azure CLI package repo
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/azure-cli.list

# install Microsoft packages
ENV ACCEPT_EULA=Y
RUN apt-get update && \
apt-get install -y --no-install-recommends \
azure-cli \
msodbcsql17 \
mssql-tools && \
rm -rf /var/lib/apt/lists/*

# add sqlcmd to the path
ENV PATH="$PATH:/opt/mssql-tools/bin"
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
38 changes: 38 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Publish Docker image for CI/CD
on:
push:
tags:
- 'docker-*'

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v1.14.1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3.7.0
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker images
uses: docker/build-push-action@v2.10.0
with:
context: "{{defaultContext}}:.github"
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 65720f7

Please sign in to comment.