Skip to content

Commit

Permalink
Add github action to publish docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
akash-akya committed Oct 15, 2022
1 parent f0bb3e3 commit a47b2fa
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
### C
# Object files
*.o

# Libraries
*.a
*.la
*.lo

# Build directories
build/
debug/
release/

# Executables
*.out
### End of C

### Python
# Byte-compiled / optimized
__pycache__/
*.py[cod]

# Unit test
.pytest_cache/
### End of Python

### VIM
# Temporary files
*~
tmp
tmp-*

# Swap
.*.swp
.*.swo

# Backup
*.bak

# Auto-generated tag files
tags
TAGS
### End of VIM

### Distribution
vips-*.tar.gz
### End of Distribution
46 changes: 46 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Docker
on:
workflow_dispatch:
push:
branches:
- 'master'
tags:
- 'v*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
Publish:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /libvips
COPY ./ /libvips

RUN \
# Install dependencies
apt-get update && \
apt-get install -y \
automake build-essential libgirepository1.0-dev \
ninja-build python3 python3-pip python3-setuptools python3-wheel \
gobject-introspection libglib2.0-dev libpng-dev \
libjpeg-turbo8-dev libwebp-dev libtiff5-dev libgif-dev \
libexif-dev libxml2-dev libpoppler-glib-dev swig \
libpango1.0-dev libmatio-dev libopenslide-dev libcfitsio-dev \
libgsf-1-dev fftw3-dev liborc-0.4-dev librsvg2-dev libimagequant-dev && \
#
# Install meson from pip since the one in apt repository is outdated
pip3 install meson && \
#
# Build and install
meson build --libdir=lib && \
cd build && meson compile && meson install && \
#
# Cleanup
cd / && rm -rf /libvips && \
pip3 uninstall -y meson && \
# TODO: should we keep these?
apt-get remove -y automake build-essential ninja-build \
python3-pip python3-setuptools python3-wheel && \
apt-get autoremove -y && \
apt-get autoclean && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

WORKDIR /data

0 comments on commit a47b2fa

Please sign in to comment.