mirror of
https://github.com/Neur0toxine/docker-golang-alpine.git
synced 2024-12-01 09:26:02 +03:00
Compare commits
3 Commits
571d8ef957
...
abee695c3a
Author | SHA1 | Date | |
---|---|---|---|
abee695c3a | |||
661ea7b075 | |||
038474b1a1 |
12
.github/workflows/buildx.yml
vendored
12
.github/workflows/buildx.yml
vendored
@ -37,6 +37,18 @@ jobs:
|
|||||||
- path: 1.19-nofaccessat2
|
- path: 1.19-nofaccessat2
|
||||||
tags: "1.19-nofaccessat2"
|
tags: "1.19-nofaccessat2"
|
||||||
platforms: linux/amd64,linux/arm64,linux/386
|
platforms: linux/amd64,linux/arm64,linux/386
|
||||||
|
- path: "1.20"
|
||||||
|
tags: "1.20"
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/386
|
||||||
|
- path: 1.20-nofaccessat2
|
||||||
|
tags: "1.20-nofaccessat2"
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/386
|
||||||
|
- path: 1.21
|
||||||
|
tags: "1.21"
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/386
|
||||||
|
- path: 1.21-nofaccessat2
|
||||||
|
tags: "1.21-nofaccessat2"
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/386
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
4
.github/workflows/dockerimage.yml
vendored
4
.github/workflows/dockerimage.yml
vendored
@ -17,3 +17,7 @@ jobs:
|
|||||||
docker run -i $(docker build -q 1.18-nofaccessat2) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version && merge-junit --version"
|
docker run -i $(docker build -q 1.18-nofaccessat2) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version && merge-junit --version"
|
||||||
docker run -i $(docker build -q 1.19) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version && merge-junit --version"
|
docker run -i $(docker build -q 1.19) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version && merge-junit --version"
|
||||||
docker run -i $(docker build -q 1.19-nofaccessat2) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version && merge-junit --version"
|
docker run -i $(docker build -q 1.19-nofaccessat2) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version && merge-junit --version"
|
||||||
|
docker run -i $(docker build -q 1.20) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version && merge-junit --version"
|
||||||
|
docker run -i $(docker build -q 1.20-nofaccessat2) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version && merge-junit --version"
|
||||||
|
docker run -i $(docker build -q 1.21) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version && merge-junit --version"
|
||||||
|
docker run -i $(docker build -q 1.21-nofaccessat2) /bin/sh -c "go version && bash --version && make --version && git --version && gcc --version && jq --version && curl --version && air -v && dlv version && which gocov && go-junit-report -version && dumb-init --version && merge-junit --version"
|
||||||
|
2
.github/workflows/hadolint.yml
vendored
2
.github/workflows/hadolint.yml
vendored
@ -10,4 +10,4 @@ jobs:
|
|||||||
- run: brew install hadolint
|
- run: brew install hadolint
|
||||||
- name: Lint Dockerfiles
|
- name: Lint Dockerfiles
|
||||||
run: |
|
run: |
|
||||||
hadolint {1.16,1.16-3.13,1.17,1.17-3.13,1.18,1.18-nofaccessat2,1.19,1.19-nofaccessat2}/Dockerfile
|
hadolint {1.16,1.16-3.13,1.17,1.17-3.13,1.18,1.18-nofaccessat2,1.19,1.19-nofaccessat2,1.20,1.20-nofaccessat2,1.21,1.21-nofaccessat2}/Dockerfile
|
||||||
|
32
1.20-nofaccessat2/Dockerfile
Normal file
32
1.20-nofaccessat2/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
FROM golang:1.20-alpine
|
||||||
|
COPY disable_faccessat2.patch /tmp/disable_faccessat2.patch
|
||||||
|
RUN set -eux; \
|
||||||
|
apk add --no-cache --virtual .build-deps gcc make patch git alpine-sdk coreutils cmake sudo && \
|
||||||
|
mkdir -p /var/cache/distfiles && \
|
||||||
|
chmod a+w /var/cache/distfiles && \
|
||||||
|
git clone --depth 1 --branch "v$(cat /etc/alpine-release)" git://git.alpinelinux.org/aports /tmp/aports && \
|
||||||
|
cd /tmp/aports/main/musl && \
|
||||||
|
mv /tmp/disable_faccessat2.patch /tmp/aports/main/musl/ && \
|
||||||
|
sed -i -E 's/\thandle-aux-at_base.patch/\thandle-aux-at_base.patch\n\tdisable_faccessat2.patch/' APKBUILD && \
|
||||||
|
adduser -G abuild -g "Alpine Package Builder" -s /bin/ash -D builder && \
|
||||||
|
echo "builder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
|
||||||
|
chown -R builder:abuild /tmp/aports && \
|
||||||
|
sudo -u builder sh -c 'abuild checksum && abuild-keygen -an && abuild -r' && \
|
||||||
|
find /home/builder -type f -name '*.apk' -exec apk add --allow-untrusted --no-cache {} \;; \
|
||||||
|
sudo -u builder sh -c 'abuild clean && abuild cleancache' && \
|
||||||
|
apk del --no-network .build-deps && \
|
||||||
|
deluser builder && \
|
||||||
|
rm -rf /home/builder /var/cache/distfiles /tmp/aports
|
||||||
|
RUN set -eux; \
|
||||||
|
apk add --no-cache bash make git gcc libc-dev jq curl dumb-init && \
|
||||||
|
go install github.com/go-delve/delve/cmd/dlv@latest && \
|
||||||
|
go install github.com/cosmtrek/air@latest && \
|
||||||
|
go install github.com/jstemmer/go-junit-report@latest && \
|
||||||
|
go install github.com/axw/gocov/gocov@latest && \
|
||||||
|
go install gotest.tools/gotestsum@latest && \
|
||||||
|
chmod -R 777 "$GOPATH" && \
|
||||||
|
curl -L https://github.com/tobni/merge-junit/releases/download/v0.1.4/merge-junit-v0.1.4-x86_64-unknown-linux-musl.tar.gz | tar -xz && \
|
||||||
|
mv ./merge-junit-v0.1.4-x86_64-unknown-linux-musl/merge-junit /usr/bin/merge-junit && \
|
||||||
|
rm -rf /merge-junit-v0.1.4-x86_64-unknown-linux-musl
|
||||||
|
WORKDIR /
|
||||||
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
23
1.20-nofaccessat2/disable_faccessat2.patch
Normal file
23
1.20-nofaccessat2/disable_faccessat2.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
--- v1.2.3/src/unistd/faccessat.c 2022-04-07 20:12:40.000000000 +0300
|
||||||
|
+++ v1.2.1/src/unistd/faccessat.c 2020-08-04 07:21:09.000000000 +0300
|
||||||
|
@@ -25,17 +25,12 @@
|
||||||
|
|
||||||
|
int faccessat(int fd, const char *filename, int amode, int flag)
|
||||||
|
{
|
||||||
|
- if (flag) {
|
||||||
|
- int ret = __syscall(SYS_faccessat2, fd, filename, amode, flag);
|
||||||
|
- if (ret != -ENOSYS) return __syscall_ret(ret);
|
||||||
|
- }
|
||||||
|
+ if (!flag || (flag==AT_EACCESS && getuid()==geteuid() && getgid()==getegid()))
|
||||||
|
+ return syscall(SYS_faccessat, fd, filename, amode, flag);
|
||||||
|
|
||||||
|
- if (flag & ~AT_EACCESS)
|
||||||
|
+ if (flag != AT_EACCESS)
|
||||||
|
return __syscall_ret(-EINVAL);
|
||||||
|
|
||||||
|
- if (!flag || (getuid()==geteuid() && getgid()==getegid()))
|
||||||
|
- return syscall(SYS_faccessat, fd, filename, amode);
|
||||||
|
-
|
||||||
|
char stack[1024];
|
||||||
|
sigset_t set;
|
||||||
|
pid_t pid;
|
10
1.20-nofaccessat2/faccessat2-test.c
Normal file
10
1.20-nofaccessat2/faccessat2-test.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
// TODO: Use this code to test resulting images.
|
||||||
|
// Should not call faccessat2 under the hood.
|
||||||
|
faccessat(0, "/", R_OK, AT_EACCESS);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
14
1.20/Dockerfile
Normal file
14
1.20/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
FROM golang:1.20-alpine
|
||||||
|
RUN set -eux; \
|
||||||
|
apk add --no-cache bash make git gcc libc-dev jq curl dumb-init && \
|
||||||
|
go install github.com/go-delve/delve/cmd/dlv@latest && \
|
||||||
|
go install github.com/cosmtrek/air@latest && \
|
||||||
|
go install github.com/jstemmer/go-junit-report@latest && \
|
||||||
|
go install github.com/axw/gocov/gocov@latest && \
|
||||||
|
go install gotest.tools/gotestsum@latest && \
|
||||||
|
chmod -R 777 "$GOPATH" && \
|
||||||
|
curl -L https://github.com/tobni/merge-junit/releases/download/v0.1.4/merge-junit-v0.1.4-x86_64-unknown-linux-musl.tar.gz | tar -xz && \
|
||||||
|
mv ./merge-junit-v0.1.4-x86_64-unknown-linux-musl/merge-junit /usr/bin/merge-junit && \
|
||||||
|
rm -rf /merge-junit-v0.1.4-x86_64-unknown-linux-musl
|
||||||
|
WORKDIR /
|
||||||
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
32
1.21-nofaccessat2/Dockerfile
Normal file
32
1.21-nofaccessat2/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
FROM golang:1.21-alpine
|
||||||
|
COPY disable_faccessat2.patch /tmp/disable_faccessat2.patch
|
||||||
|
RUN set -eux; \
|
||||||
|
apk add --no-cache --virtual .build-deps gcc make patch git alpine-sdk coreutils cmake sudo && \
|
||||||
|
mkdir -p /var/cache/distfiles && \
|
||||||
|
chmod a+w /var/cache/distfiles && \
|
||||||
|
git clone --depth 1 --branch "v$(cat /etc/alpine-release)" git://git.alpinelinux.org/aports /tmp/aports && \
|
||||||
|
cd /tmp/aports/main/musl && \
|
||||||
|
mv /tmp/disable_faccessat2.patch /tmp/aports/main/musl/ && \
|
||||||
|
sed -i -E 's/\thandle-aux-at_base.patch/\thandle-aux-at_base.patch\n\tdisable_faccessat2.patch/' APKBUILD && \
|
||||||
|
adduser -G abuild -g "Alpine Package Builder" -s /bin/ash -D builder && \
|
||||||
|
echo "builder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
|
||||||
|
chown -R builder:abuild /tmp/aports && \
|
||||||
|
sudo -u builder sh -c 'abuild checksum && abuild-keygen -an && abuild -r' && \
|
||||||
|
find /home/builder -type f -name '*.apk' -exec apk add --allow-untrusted --no-cache {} \;; \
|
||||||
|
sudo -u builder sh -c 'abuild clean && abuild cleancache' && \
|
||||||
|
apk del --no-network .build-deps && \
|
||||||
|
deluser builder && \
|
||||||
|
rm -rf /home/builder /var/cache/distfiles /tmp/aports
|
||||||
|
RUN set -eux; \
|
||||||
|
apk add --no-cache bash make git gcc libc-dev jq curl dumb-init && \
|
||||||
|
go install github.com/go-delve/delve/cmd/dlv@latest && \
|
||||||
|
go install github.com/cosmtrek/air@latest && \
|
||||||
|
go install github.com/jstemmer/go-junit-report@latest && \
|
||||||
|
go install github.com/axw/gocov/gocov@latest && \
|
||||||
|
go install gotest.tools/gotestsum@latest && \
|
||||||
|
chmod -R 777 "$GOPATH" && \
|
||||||
|
curl -L https://github.com/tobni/merge-junit/releases/download/v0.1.4/merge-junit-v0.1.4-x86_64-unknown-linux-musl.tar.gz | tar -xz && \
|
||||||
|
mv ./merge-junit-v0.1.4-x86_64-unknown-linux-musl/merge-junit /usr/bin/merge-junit && \
|
||||||
|
rm -rf /merge-junit-v0.1.4-x86_64-unknown-linux-musl
|
||||||
|
WORKDIR /
|
||||||
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
23
1.21-nofaccessat2/disable_faccessat2.patch
Normal file
23
1.21-nofaccessat2/disable_faccessat2.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
--- v1.2.3/src/unistd/faccessat.c 2022-04-07 20:12:40.000000000 +0300
|
||||||
|
+++ v1.2.1/src/unistd/faccessat.c 2020-08-04 07:21:09.000000000 +0300
|
||||||
|
@@ -25,17 +25,12 @@
|
||||||
|
|
||||||
|
int faccessat(int fd, const char *filename, int amode, int flag)
|
||||||
|
{
|
||||||
|
- if (flag) {
|
||||||
|
- int ret = __syscall(SYS_faccessat2, fd, filename, amode, flag);
|
||||||
|
- if (ret != -ENOSYS) return __syscall_ret(ret);
|
||||||
|
- }
|
||||||
|
+ if (!flag || (flag==AT_EACCESS && getuid()==geteuid() && getgid()==getegid()))
|
||||||
|
+ return syscall(SYS_faccessat, fd, filename, amode, flag);
|
||||||
|
|
||||||
|
- if (flag & ~AT_EACCESS)
|
||||||
|
+ if (flag != AT_EACCESS)
|
||||||
|
return __syscall_ret(-EINVAL);
|
||||||
|
|
||||||
|
- if (!flag || (getuid()==geteuid() && getgid()==getegid()))
|
||||||
|
- return syscall(SYS_faccessat, fd, filename, amode);
|
||||||
|
-
|
||||||
|
char stack[1024];
|
||||||
|
sigset_t set;
|
||||||
|
pid_t pid;
|
10
1.21-nofaccessat2/faccessat2-test.c
Normal file
10
1.21-nofaccessat2/faccessat2-test.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
// TODO: Use this code to test resulting images.
|
||||||
|
// Should not call faccessat2 under the hood.
|
||||||
|
faccessat(0, "/", R_OK, AT_EACCESS);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
14
1.21/Dockerfile
Normal file
14
1.21/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
FROM golang:1.21-alpine
|
||||||
|
RUN set -eux; \
|
||||||
|
apk add --no-cache bash make git gcc libc-dev jq curl dumb-init && \
|
||||||
|
go install github.com/go-delve/delve/cmd/dlv@latest && \
|
||||||
|
go install github.com/cosmtrek/air@latest && \
|
||||||
|
go install github.com/jstemmer/go-junit-report@latest && \
|
||||||
|
go install github.com/axw/gocov/gocov@latest && \
|
||||||
|
go install gotest.tools/gotestsum@latest && \
|
||||||
|
chmod -R 777 "$GOPATH" && \
|
||||||
|
curl -L https://github.com/tobni/merge-junit/releases/download/v0.1.4/merge-junit-v0.1.4-x86_64-unknown-linux-musl.tar.gz | tar -xz && \
|
||||||
|
mv ./merge-junit-v0.1.4-x86_64-unknown-linux-musl/merge-junit /usr/bin/merge-junit && \
|
||||||
|
rm -rf /merge-junit-v0.1.4-x86_64-unknown-linux-musl
|
||||||
|
WORKDIR /
|
||||||
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
@ -4,11 +4,11 @@
|
|||||||
[![buildx Status](https://github.com/Neur0toxine/docker-golang-alpine/workflows/buildx/badge.svg)](https://github.com/Neur0toxine/docker-golang-alpine/actions?query=workflow%3Abuildx)
|
[![buildx Status](https://github.com/Neur0toxine/docker-golang-alpine/workflows/buildx/badge.svg)](https://github.com/Neur0toxine/docker-golang-alpine/actions?query=workflow%3Abuildx)
|
||||||
[![Lint Dockerfiles](https://github.com/Neur0toxine/docker-golang-alpine/workflows/Lint%20Dockerfiles/badge.svg)](https://github.com/Neur0toxine/docker-golang-alpine/actions?query=workflow%3A%22Lint+Dockerfiles%22)
|
[![Lint Dockerfiles](https://github.com/Neur0toxine/docker-golang-alpine/workflows/Lint%20Dockerfiles/badge.svg)](https://github.com/Neur0toxine/docker-golang-alpine/actions?query=workflow%3A%22Lint+Dockerfiles%22)
|
||||||
|
|
||||||
A minimal Dockerfile based on Go 1.16, 1.17, 1.18 and alpine with dumb-init and some other useful packages.
|
A minimal Dockerfile based on Go 1.16, 1.17, 1.18, 1.19, 1.20, 1.21 and alpine with dumb-init and some other useful packages.
|
||||||
|
|
||||||
## What's included
|
## What's included
|
||||||
|
|
||||||
- Go 1.16 / 1.17 / 1.18 / 1.19
|
- Go 1.16 / 1.17 / 1.18 / 1.19 / 1.20 / 1.21
|
||||||
- images with patched musl to disable `faccessat2` syscall (workaround for CI systems with docker & seccomp filter bug, [see this](https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2))
|
- images with patched musl to disable `faccessat2` syscall (workaround for CI systems with docker & seccomp filter bug, [see this](https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2))
|
||||||
- bash
|
- bash
|
||||||
- make
|
- make
|
||||||
|
Loading…
Reference in New Issue
Block a user