Skip to content

Commit 658e78e

Browse files
committed
Simplified usage
1 parent 859b5f9 commit 658e78e

File tree

4 files changed

+35
-48
lines changed

4 files changed

+35
-48
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh/*

Dockerfile

+10-47
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,18 @@
1-
FROM registry.fedoraproject.org/fedora:30 as flamel
21

3-
MAINTAINER Fernando Lozano <[email protected]>
2+
FROM quay.io/flozanorht/flamel:0.3-7 as pre-commit
43

5-
# Adding "-subrelease" to packages, such as SLIDES="-1.2.0-1", breaks the build.
6-
# Having the dash as part of each version string allows installing whatever is latest by default, or forcing the build to use a fixed release
4+
RUN curl https://pre-commit.com/install-local.py | python - & \
5+
ln -s /root/bin/pre-commit /usr/bin/pre-commit & \
6+
dnf install -y perl ruby
77

8-
ARG CURRICULUM="-22-1"
9-
ARG BRANDING
10-
ARG FLAMEL
11-
ARG SLIDES
12-
ARG BOOKDIR="/tmp/coursebook"
13-
14-
# Make sure we get English error messages to share with the team.
15-
16-
ENV LANG="en_US.utf-8" \
17-
BOOK="${BOOKDIR}"
18-
19-
RUN curl http://wiki.gls.redhat.com/curriculum-repos/fedora/30/x86_64/curriculum-release-fedora${CURRICULUM}.fc30.noarch.rpm -o /tmp/curriculum-release-fedora${CURRICULUM}.fc30.noarch.rpm \
20-
&& dnf -y install /tmp/*rpm \
21-
&& rm -f /tmp/*rpm \
22-
&& dnf --nodocs -y install \
23-
publican-gls-redhat-new redhat-training-xsl${BRANDING} reveal-js-slide-generator${SLIDES} \
24-
interstate-fonts overpass-fonts flamel${FLAMEL} git \
25-
&& dnf clean all \
26-
&& mkdir -p ${BOOK}
27-
28-
COPY check-gls-packages.sh /tmp
29-
30-
VOLUME ${BOOK}
8+
FROM pre-commit
319

32-
WORKDIR ${BOOK}/guides
33-
34-
# Install pre-commit in a separate container.
35-
36-
FROM flamel as pre-commit
37-
38-
RUN pip install --upgrade pip &&\
39-
pip install --upgrade wheel setuptools &&\
40-
pip install pre-commit
41-
42-
# Install additional packages and interpreters
43-
FROM pre-commit as pre-commit-hooks
10+
ARG BOOKDIR="/tmp/coursebook"
4411

45-
RUN dnf install -y perl ruby
12+
ENV LANG="en_US.utf-8"
4613

47-
# Setup ssh identities
48-
FROM pre-commit-hooks
14+
ENTRYPOINT ["pre-commit"]
4915

50-
RUN mkdir /root/.ssh
51-
#COPY ssh /root/.ssh
52-
RUN chmod 0400 /root/.ssh/*
53-
WORKDIR ${BOOK}
16+
WORKDIR ${BOOKDIR}
5417

55-
CMD ["pre-commit","run","-a"]
18+
CMD ["run","-a"]

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
Docker image for running GLS pre-commit hooks.
1+
Docker image for running GLS pre-commit hooks.
2+
3+
Usage:
4+
Just run "pre-commit.sh" or alias it to "pre-commit" in your system.
5+
6+
If your SSH configuration or your pre-commit cache is not in the default locations, update the appropriate variables in the "pre-commit.sh" script file as needed.

pre-commit.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /bin/sh
2+
3+
image=quay.io/someth2say/pre-commit:0.1.0
4+
5+
book=$(pwd)
6+
container_book=/tmp/coursebook
7+
8+
ssh_cfg=~/.ssh
9+
container_ssh_cfg=/root/.ssh
10+
11+
pcommit_cache=~/.cache/pre-commit
12+
containe_pcommit_cache=/root/.cache/pre-commit
13+
14+
docker run \
15+
-v ${ssh_cfg}:${container_ssh_cfg} \
16+
-v ${pcommit_cache}:${containe_pcommit_cache}:z \
17+
-v ${book}:${container_book}:z \
18+
${image} $@

0 commit comments

Comments
 (0)