Skip to content

Commit

Permalink
Prepare v3
Browse files Browse the repository at this point in the history
- Update Ruby base image
- Update msync to latest v3
- Push to GHCR.io as per tech-alignment
- Automate version upgrades
- Remove stuff for old versions

Signed-off-by: Manuel Hutter <[email protected]>
  • Loading branch information
mhutter committed Oct 25, 2024
1 parent 9ef9792 commit 8479734
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 459 deletions.
6 changes: 1 addition & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
.tox/
.git/
.gitignore
LICENSE
README.md
*
47 changes: 47 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Container Image

on:
push:
branches:
- main
- master
tags:
- "v*"
pull_request: {}

env:
REGISTRY: ghcr.io
IMAGE_NAME: modulesync

jobs:
# Push image to GitHub Packages.
container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Log in to the Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Determine Tags & Labels based on Git ref
id: meta
uses: docker/metadata-action@v5
with:
images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"

- name: Build & Push container image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
20 changes: 0 additions & 20 deletions 0.10.0/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions 0.9.0/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions 1.0.0/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions 1.1.0/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions 1.2.0/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions 1.3.0/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions 2.0.0/Dockerfile

This file was deleted.

33 changes: 12 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
FROM ruby:2.7-slim

LABEL maintainer="VSHN AG <[email protected]>"

FROM docker.io/library/ruby:3.3-slim
WORKDIR /app

RUN adduser --disabled-password --gecos '' msync \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
ssh \
&& git clone --depth=1 https://github.com/voxpupuli/modulesync.git \
&& cd modulesync \
&& gem build modulesync.gemspec \
&& gem install --no-document modulesync-*.gem \
&& apt-get purge -y build-essential \
&& apt-get autoremove --purge -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& cd .. \
&& rm -rf modulesync
openssh-client && \
apt-get clean all && \
rm -rf /var/lib/apt/lists/* && \
adduser --disabled-password --gecos '' msync

USER msync
# renovate: datasource=rubygems depName=modulesync versioning=ruby
ENV MODULESYNC_VERSION="3.2.0"
RUN gem install modulesync --version="$MODULESYNC_VERSION"

CMD ["msync"]
USER msync
CMD ["msync", "help"]
108 changes: 13 additions & 95 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
ModuleSync
==========
# ModuleSync

[![dockeri.co](http://dockeri.co/image/vshn/modulesync)](https://hub.docker.com/r/vshn/modulesync/)

[![Build Status](https://img.shields.io/travis/vshn/docker-modulesync/master.svg)](https://travis-ci.org/vshn/docker-modulesync
) [![GitHub issues](https://img.shields.io/github/issues-raw/vshn/docker-modulesync.svg)](https://github.com/vshn/docker-modulesync/issues
) [![GitHub PRs](https://img.shields.io/github/issues-pr-raw/vshn/docker-modulesync.svg)](https://github.com/vshn/docker-modulesync/pulls
) [![License](https://img.shields.io/github/license/vshn/docker-modulesync.svg)](https://github.com/vshn/docker-modulesync/blob/master/LICENSE)

Repository File Sync
--------------------
## Repository File Sync

Originally, a utility script to keep configuration files in sync for Puppet modules,
[ModuleSync](https://github.com/voxpupuli/modulesync/) allows you to keep files in
Expand All @@ -23,101 +14,28 @@ This Docker image runs ModuleSync with an unprivileged `msync` user in `/app`.
See [Concierge](https://github.com/vshn/docker-concierge/) if you want to sync
multiple configurations from a single configuration repository.

Supported Tags
--------------

- [![latest](
https://img.shields.io/badge/latest-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/docker-modulesync/blob/master/Dockerfile) [![size/layers](
https://images.microbadger.com/badges/image/vshn/modulesync:latest.svg)](
https://microbadger.com/images/vshn/modulesync:latest) [![based on](
https://img.shields.io/badge/Git-master-grey.svg?colorA=5a5b5c&colorB=9a9b9c&logo=github)](
https://github.com/voxpupuli/modulesync)
- [![2.0.0](
https://img.shields.io/badge/2.0.0-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/docker-modulesync/blob/master/2.0.0/Dockerfile) [![size/layers](
https://images.microbadger.com/badges/image/vshn/modulesync:2.0.0.svg)](
https://microbadger.com/images/vshn/modulesync:2.0.0) [![based on](
https://img.shields.io/badge/Gem-2.0.0-red.svg?colorA=ff919f&colorB=9a9b9c&logo=ruby)](
https://rubygems.org/gems/modulesync/versions/2.0.0)
- [![1.3.0](
https://img.shields.io/badge/1.3.0-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/docker-modulesync/blob/master/1.3.0/Dockerfile) [![size/layers](
https://images.microbadger.com/badges/image/vshn/modulesync:1.3.0.svg)](
https://microbadger.com/images/vshn/modulesync:1.3.0) [![based on](
https://img.shields.io/badge/Gem-1.3.0-red.svg?colorA=ff919f&colorB=9a9b9c&logo=ruby)](
https://rubygems.org/gems/modulesync/versions/1.3.0)
- [![1.2.0](
https://img.shields.io/badge/1.2.0-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/docker-modulesync/blob/master/1.2.0/Dockerfile) [![size/layers](
https://images.microbadger.com/badges/image/vshn/modulesync:1.2.0.svg)](
https://microbadger.com/images/vshn/modulesync:1.2.0) [![based on](
https://img.shields.io/badge/Gem-1.2.0-red.svg?colorA=ff919f&colorB=9a9b9c&logo=ruby)](
https://rubygems.org/gems/modulesync/versions/1.2.0)
- [![1.1.0](
https://img.shields.io/badge/1.1.0-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/docker-modulesync/blob/master/1.1.0/Dockerfile) [![size/layers](
https://images.microbadger.com/badges/image/vshn/modulesync:1.1.0.svg)](
https://microbadger.com/images/vshn/modulesync:1.1.0) [![based on](
https://img.shields.io/badge/Gem-1.1.0-red.svg?colorA=ff919f&colorB=9a9b9c&logo=ruby)](
https://rubygems.org/gems/modulesync/versions/1.1.0)
- [![1.0.0](
https://img.shields.io/badge/1.0.0-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/docker-modulesync/blob/master/1.0.0/Dockerfile) [![size/layers](
https://images.microbadger.com/badges/image/vshn/modulesync:1.0.0.svg)](
https://microbadger.com/images/vshn/modulesync:1.0.0) [![based on](
https://img.shields.io/badge/Gem-1.0.0-red.svg?colorA=ff919f&colorB=9a9b9c&logo=ruby)](
https://rubygems.org/gems/modulesync/versions/1.0.0)
- [![0.10.0](
https://img.shields.io/badge/0.10.0-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/docker-modulesync/blob/master/0.10.0/Dockerfile) [![size/layers](
https://images.microbadger.com/badges/image/vshn/modulesync:0.10.0.svg)](
https://microbadger.com/images/vshn/modulesync:0.10.0) [![based on](
https://img.shields.io/badge/Gem-0.10.0-red.svg?colorA=ff919f&colorB=9a9b9c&logo=ruby)](
https://rubygems.org/gems/modulesync/versions/0.10.0)
- [![0.9.0](
https://img.shields.io/badge/0.9.0-blue.svg?colorA=22313f&colorB=4a637b&logo=docker)](
https://github.com/vshn/docker-modulesync/blob/master/0.9.0/Dockerfile) [![size/layers](
https://images.microbadger.com/badges/image/vshn/modulesync:0.9.0.svg)](
https://microbadger.com/images/vshn/modulesync:0.9.0) [![based on](
https://img.shields.io/badge/Gem-0.9.0-red.svg?colorA=ff919f&colorB=9a9b9c&logo=ruby)](
https://rubygems.org/gems/modulesync/versions/0.9.0)

Usage
-----
## Usage

In a GitLab CI configuration file:

```
image: vshn/modulesync
script:
- msync update
```

In a Docker Compose file as a pseudo-service:

```
modulesync:
image: vshn/modulesync
volumes:
- .:/app
```yaml
image: ghcr.io/vshn/modulesync
script:
- msync update
```
With Docker on the command line:
```bash
$ docker run --rm -v "$PWD":/app vshn/modulesync msync update
```sh
$ docker run --rm -v "$PWD":/app ghcr.io/vshn/modulesync msync update
```

Development
-----------
## Development

- [Issue tracker](https://github.com/vshn/docker-modulesync/) (GitHub)

To add a new ModuleSync version tag:

1. Add the version number to the [update script](
https://github.com/vshn/docker-modulesync/blob/master/update.py#L7-L10), and
1. Run `./update.py` and update the Docker build settings as indicated.

Please, run [tox](https://tox.readthedocs.io/) before contributing changes.
1. Renovate should automatically create a [Pull Request](https://github.com/vshn/docker-modulesync/pulls).
1. After merging it, make sure you pulled the latest commits, and run `./tag.sh` to create an appropriate Git Tag.
1. `git push --follow-tags` to push the tag. A new docker image is built automatically.
14 changes: 14 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended"],
"customManagers": [
{
"customType": "regex",
"fileMatch": ["^Dockerfile$"],
"matchStrings": [
"#\\s*renovate:\\s*datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\sENV .*?_VERSION=\"(?<currentValue>.*)\"\\s"
],
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
}
]
}
7 changes: 7 additions & 0 deletions tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

tag="v$(awk -F'=' '/ENV MODULESYNC_VERSION/{ print $2 }' Dockerfile)"
git tag -s "${tag}" -m "Release ${tag}"

echo "---> Tagged as ${tag}"
echo " Don't forget to push the tag: git push --follow-tags"
Loading

0 comments on commit 8479734

Please sign in to comment.