Skip to content

Commit 45af966

Browse files
skaleeribose-jeffreylau
authored andcommitted
Create a Dockerfile
Write a Dockerfile which inherits from Centos:7 image, and has the latest GnuPG installed.
1 parent e0e6df7 commit 45af966

File tree

4 files changed

+64
-21
lines changed

4 files changed

+64
-21
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM centos:7
2+
3+
ARG GNUPG_VERSION=latest
4+
ARG CONFIGURE_OPTS="--enable-gpg2-is-gpg"
5+
6+
RUN yum install -y bzip2 gcc make sudo ncurses-devel
7+
8+
WORKDIR /usr/local/src/gpg-build-scripts
9+
COPY . .
10+
RUN ./install_gpg_all.sh --suite-version "${GNUPG_VERSION}" --sudo --configure-opts "${CONFIGURE_OPTS}"
11+
12+
WORKDIR /root

docker.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/docker_images.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
set -e # Early exit if any command returns non-zero status code
4+
set -v # Print executed lines
5+
6+
# This example shows how to use GnuPG Docker image.
7+
8+
###############
9+
# SETUP #
10+
###############
11+
12+
docker build -t gnupg:latest --build-arg GNUPG_VERSION=latest .
13+
docker build -t gnupg:2.2 --build-arg GNUPG_VERSION=2.2 .
14+
docker build -t gnupg:2.1 --build-arg GNUPG_VERSION=2.1 .
15+
16+
###############
17+
# TESTS #
18+
###############
19+
20+
# Assert installed versions…
21+
# (All images are configured to have GnuPG executable at /usr/local/bin/gpg)
22+
docker run -i gnupg:latest gpg --version | head -n 1 | cut -d" " -f 3 | grep -xE "2\.2\.[0-9]+"
23+
docker run -i gnupg:2.2 gpg --version | head -n 1 | cut -d" " -f 3 | grep -xE "2\.2\.[0-9]+"
24+
docker run -i gnupg:2.1 gpg --version | head -n 1 | cut -d" " -f 3 | grep -xE "2\.1\.[0-9]+"
25+
26+
# Assert that it works (is capable of clearsigning files)…
27+
docker run -i gnupg:latest /bin/bash > signed.out <<-SH
28+
gpg --gen-key --batch <<-KEY_PARAMS
29+
%no-protection
30+
Key-Type: RSA
31+
Key-Usage: sign, cert
32+
Key-Length: 2048
33+
Subkey-Type: RSA
34+
Subkey-Length: 2048
35+
Subkey-Usage: encrypt
36+
Name-Real: Some User
37+
Name-Email: [email protected]
38+
Name-Comment: Without passphrase
39+
Expire-Date: 0
40+
KEY_PARAMS
41+
42+
echo "it is very important" > ~/important.txt
43+
44+
gpg --clearsign ~/important.txt
45+
46+
cat ~/important.txt.asc
47+
SH
48+
49+
grep signed.out -xe "-----BEGIN PGP SIGNED MESSAGE-----"
50+
grep signed.out -xe "it is very important"

0 commit comments

Comments
 (0)