Skip to content

Commit 8c44011

Browse files
committed
Test
1 parent 1911940 commit 8c44011

File tree

8 files changed

+57
-77
lines changed

8 files changed

+57
-77
lines changed
Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG CONTAINER_REGISTRY=""
22

3-
FROM ${CONTAINER_REGISTRY}alpine:3.21
4-
ENV GOSU_VERSION 1.16
3+
FROM ${CONTAINER_REGISTRY}alpine
4+
ENV GOSU_VERSION 1.14
55

66
RUN set -eux; \
77
\
@@ -10,28 +10,11 @@ RUN set -eux; \
1010
bash \
1111
ca-certificates \
1212
doas \
13-
gnupg \
1413
dpkg \
1514
sudo \
16-
wget \
17-
tini \
18-
; \
19-
\
20-
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
21-
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
22-
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
23-
\
24-
# verify the signature
25-
export GNUPGHOME="$(mktemp -d)"; \
26-
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
27-
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
28-
command -v gpgconf && gpgconf --kill all || :; \
29-
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
30-
chmod +x /usr/local/bin/gosu; \
31-
# verify that the binary works
32-
gosu --version; \
33-
gosu nobody true
34-
15+
wget
16+
# Test
17+
RUN update-ca-certificates
3518

3619
# Create unprivileged user for building, see
3720
# https://github.com/hexops/dockerfile#use-a-static-uid-and-gid
@@ -56,14 +39,7 @@ RUN --mount=type=secret,id=gpg,gid=1000,uid=1000,dst=/tmp/private.rsa \
5639
fi
5740

5841
# Prepare entrypoint
59-
# COPY --chown=builder:abuild entrypoint.sh /home/builder/entrypoint.sh
60-
# RUN chmod +x /home/builder/entrypoint.sh
61-
# ENTRYPOINT ["/home/builder/entrypoint.sh"]
62-
63-
# Prepare entrypoint and build scripts
64-
ADD entrypoint.sh /entrypoint.sh
65-
ADD build.sh /home/builder/build.sh
66-
USER root
67-
RUN chmod +x /home/builder/build.sh
42+
COPY --chown=builder:abuild entrypoint.sh /home/builder/entrypoint.sh
43+
RUN chmod +x /home/builder/entrypoint.sh
6844

69-
ENTRYPOINT ["/sbin/tini", "--", "/bin/bash", "/entrypoint.sh" ]
45+
ENTRYPOINT ["/home/builder/entrypoint.sh"]
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#!/usr/bin/env bash
22
set -euox pipefail
33

4-
# The directory mounted into the container has the UID/GID of the host user. In order to allow the user builder to write
5-
# into it without changing its ownership (which could render the folder or its contents inaccessible to the host user),
6-
# add the user builder to the group with the same GID as the host user.
7-
HOST_USER_GID=$(stat -c "%g" /home/builder/out)
8-
getent group "$HOST_USER_GID" || (addgroup -g "$HOST_USER_GID" hostusrg && addgroup builder hostusrg)
9-
chmod g+w /home/builder/out
10-
11-
# Drop root privileges and build the package.
12-
gosu builder /home/builder/build.sh
4+
# Copy build scripts into a directory within the container. Avoids polluting the mounted
5+
# directory and permission errors.
6+
mkdir /home/builder/workspace
7+
cp -R /home/builder/build/generated/packaging /home/builder/workspace
8+
9+
# Set permssions
10+
sudo chown -R builder /home/builder/out
11+
12+
# Build package and set distributions it supports
13+
cd /home/builder/workspace/packaging
14+
abuild -r
15+
16+
arch=$(abuild -A)
17+
18+
# Copy resulting files into mounted directory where artifacts should be placed.
19+
mv /home/builder/packages/workspace/$arch/*.{apk,tar.gz} /home/builder/out

linux/jre/alpine/src/main/packaging/Dockerfile

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG CONTAINER_REGISTRY=""
22

3-
FROM ${CONTAINER_REGISTRY}alpine:3.21
4-
ENV GOSU_VERSION 1.16
3+
FROM ${CONTAINER_REGISTRY}alpine
4+
ENV GOSU_VERSION 1.14
55

66
RUN set -eux; \
77
\
@@ -10,27 +10,11 @@ RUN set -eux; \
1010
bash \
1111
ca-certificates \
1212
doas \
13-
gnupg \
1413
dpkg \
1514
sudo \
16-
wget \
17-
; \
18-
\
19-
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
20-
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
21-
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
22-
\
23-
# verify the signature
24-
export GNUPGHOME="$(mktemp -d)"; \
25-
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
26-
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
27-
command -v gpgconf && gpgconf --kill all || :; \
28-
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
29-
chmod +x /usr/local/bin/gosu; \
30-
# verify that the binary works
31-
gosu --version; \
32-
gosu nobody true
33-
15+
wget
16+
# Test
17+
RUN update-ca-certificates
3418

3519
# Create unprivileged user for building, see
3620
# https://github.com/hexops/dockerfile#use-a-static-uid-and-gid
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#!/usr/bin/env bash
22
set -euox pipefail
33

4-
# The directory mounted into the container has the UID/GID of the host user. In order to allow the user builder to write
5-
# into it without changing its ownership (which could render the folder or its contents inaccessible to the host user),
6-
# add the user builder to the group with the same GID as the host user.
7-
HOST_USER_GID=$(stat -c "%g" /home/builder/out)
8-
getent group "$HOST_USER_GID" || (addgroup -g "$HOST_USER_GID" hostusrg && addgroup builder hostusrg)
9-
chmod g+w /home/builder/out
10-
11-
# Drop root privileges and build the package.
12-
gosu builder /home/builder/build.sh
4+
# Copy build scripts into a directory within the container. Avoids polluting the mounted
5+
# directory and permission errors.
6+
mkdir /home/builder/workspace
7+
cp -R /home/builder/build/generated/packaging /home/builder/workspace
8+
9+
# Set permssions
10+
sudo chown -R builder /home/builder/out
11+
12+
# Build package and set distributions it supports
13+
cd /home/builder/workspace/packaging
14+
abuild -r
15+
16+
arch=$(abuild -A)
17+
18+
# Copy resulting files into mounted directory where artifacts should be placed.
19+
mv /home/builder/packages/workspace/$arch/*.{apk,tar.gz} /home/builder/out

linux_new/jdk/alpine/src/main/packaging/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG CONTAINER_REGISTRY=""
22

3-
FROM ${CONTAINER_REGISTRY}alpine:3.21
3+
FROM ${CONTAINER_REGISTRY}alpine
44
ENV GOSU_VERSION 1.14
55

66
RUN set -eux; \
@@ -13,6 +13,8 @@ RUN set -eux; \
1313
dpkg \
1414
sudo \
1515
wget
16+
# Test
17+
RUN update-ca-certificates
1618

1719
# Create unprivileged user for building, see
1820
# https://github.com/hexops/dockerfile#use-a-static-uid-and-gid

linux_new/jdk/alpine/src/main/packaging/entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ sudo chown -R builder /home/builder/out
1111

1212
# Build package and set distributions it supports
1313
cd /home/builder/workspace/packaging
14-
ABUILD_OPTS="--no-repo-update"
1514
abuild -r
1615

1716
arch=$(abuild -A)

linux_new/jre/alpine/src/main/packaging/Dockerfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG CONTAINER_REGISTRY=""
22

3-
FROM ${CONTAINER_REGISTRY}alpine:3.21
3+
FROM ${CONTAINER_REGISTRY}alpine
44
ENV GOSU_VERSION 1.14
55

66
RUN set -eux; \
@@ -9,15 +9,21 @@ RUN set -eux; \
99
alpine-sdk \
1010
bash \
1111
ca-certificates \
12+
doas \
1213
dpkg \
13-
sudo
14+
sudo \
15+
wget
16+
# Test
17+
RUN update-ca-certificates
1418

1519
# Create unprivileged user for building, see
1620
# https://github.com/hexops/dockerfile#use-a-static-uid-and-gid
1721
RUN adduser -D -h /home/builder builder \
1822
&& addgroup builder abuild \
19-
&& echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
23+
&& echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers \
24+
&& echo 'permit builder as root' > /etc/doas.d/doas.conf
2025

26+
# Add GPG key
2127
USER builder
2228
WORKDIR /home/builder
2329
RUN --mount=type=secret,id=gpg,gid=1000,uid=1000,dst=/tmp/private.rsa \

linux_new/jre/alpine/src/main/packaging/entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ sudo chown -R builder /home/builder/out
1111

1212
# Build package and set distributions it supports
1313
cd /home/builder/workspace/packaging
14-
ABUILD_OPTS="--no-repo-update"
1514
abuild -r
1615

1716
arch=$(abuild -A)

0 commit comments

Comments
 (0)