-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 115506f
Showing
9 changed files
with
613 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
name: devel | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- staging | ||
- trying | ||
|
||
env: | ||
DOCKER_IMAGE: localhost:5000/github.com/joseluisq/alpine-curl | ||
|
||
jobs: | ||
docker-alpine: | ||
name: Docker test | ||
strategy: | ||
matrix: | ||
arch: | ||
- linux/amd64 | ||
- linux/386 | ||
- linux/arm64 | ||
- linux/arm/v7 | ||
- linux/arm/v6 | ||
- linux/ppc64le | ||
- linux/s390x | ||
runs-on: ubuntu-20.04 | ||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- | ||
name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: static-web-server-${{ matrix.arch }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
static-web-server-${{ matrix.arch }}-buildx- | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Docker meta alpine | ||
id: meta_alpine | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.DOCKER_IMAGE }} | ||
flavor: | | ||
latest=true | ||
tags: | | ||
type=schedule | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=sha | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
driver-opts: network=host | ||
- | ||
name: Build and export to Docker client | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: ${{ matrix.arch }} | ||
file: Dockerfile | ||
load: true | ||
tags: ${{ steps.meta_alpine.outputs.tags }} | ||
labels: ${{ steps.meta_alpine.outputs.labels }} | ||
- | ||
name: Build and push to local registry | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: ${{ matrix.arch }} | ||
file: Dockerfile | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta_alpine.outputs.tags }} | ||
labels: ${{ steps.meta_alpine.outputs.labels }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | ||
- | ||
name: Test | ||
uses: addnab/docker-run-action@v1 | ||
with: | ||
image: ${{ env.DOCKER_IMAGE }} | ||
run: | | ||
uname -a | ||
curl --version | ||
cat /etc/os-release | ||
- | ||
name: Inspect image | ||
run: | | ||
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta_alpine.outputs.version }} | ||
- | ||
name: Check manifest | ||
if: github.event_name != 'pull_request' | ||
run: | | ||
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta_alpine.outputs.version }} | ||
- | ||
# Temp fix | ||
# https://github.com/docker/build-push-action/issues/252 | ||
# https://github.com/moby/buildkit/issues/1896 | ||
name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- 'v1.[0-9]+.[0-9]+' | ||
- 'v1.[0-9]+.[0-9]+-beta.[0-9]+' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: joseluisq/alpine-curl | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Prepare Docker envs | ||
shell: bash | ||
run: | | ||
echo "VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
context: . | ||
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le,linux/s390x | ||
file: Dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
build-args: | | ||
VERSION=${{ env.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.~ | ||
**/*.tgz | ||
**/*.gz | ||
**/*.zip | ||
**/*.gzip | ||
**/*.zst | ||
**/*.log | ||
**/*.tar | ||
**/*.txt | ||
**/.DS_Store | ||
*.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
# NOTE: This is adapted from the official https://github.com/curl/curl-docker/blob/master/alpine/latest/Dockerfile | ||
|
||
FROM alpine:3.16.5 AS builder | ||
|
||
ARG VERSION=0.0.0 | ||
ENV VERSION=${VERSION} | ||
|
||
# https://github.com/curl/curl | ||
ARG CURL_VERSION="8.0.1" | ||
ENV CURL_VERSION=${CURL_VERSION} | ||
|
||
# Install dependencies | ||
RUN set -eux \ | ||
&& apk add --no-cache \ | ||
autoconf \ | ||
automake \ | ||
brotli \ | ||
brotli-dev \ | ||
build-base \ | ||
ca-certificates \ | ||
curl \ | ||
curl-dev \ | ||
groff \ | ||
libssh2 \ | ||
libssh2-dev \ | ||
libssh2-static \ | ||
libtool \ | ||
nghttp2 \ | ||
openssl \ | ||
perl \ | ||
python3 \ | ||
python3-dev \ | ||
stunnel \ | ||
tzdata \ | ||
zstd \ | ||
zstd-dev \ | ||
&& true | ||
|
||
# Get CA cert bundle from curl.haxx.se | ||
RUN set -eux \ | ||
&& curl https://curl.haxx.se/ca/cacert.pem -L -o /cacert.pem \ | ||
&& true | ||
|
||
# Build the tag version | ||
RUN set -eux \ | ||
&& mkdir -p /src/curl \ | ||
&& curl -Lo curl.tar.gz https://github.com/curl/curl/releases/download/curl-8_0_1/curl-${CURL_VERSION}.tar.gz \ | ||
&& tar xfz curl.tar.gz --strip-components=1 -C /src/curl \ | ||
&& true | ||
WORKDIR /src/curl | ||
|
||
# Build the tag version | ||
RUN set -eux \ | ||
&& autoreconf -vif \ | ||
&& ./configure \ | ||
--enable-static \ | ||
--disable-ldap \ | ||
--enable-ipv6 \ | ||
--enable-unix-sockets \ | ||
--with-ssl \ | ||
--with-libssh2 \ | ||
--with-nghttp2=/usr \ | ||
--with-zstd=/usr \ | ||
--prefix=/usr/local \ | ||
&& make -j$(nproc) \ | ||
&& make DESTDIR="/alpine/" install -j$(nproc) \ | ||
&& true | ||
|
||
# Deploy Alpine curl image | ||
FROM alpine:3.16.5 | ||
|
||
LABEL Maintainer="Jose Quintana <joseluisq.net>" \ | ||
Description="Unofficial Curl Alpine Linux." | ||
|
||
ARG CURL_RELEASE_VERSION | ||
ARG CURL_GIT_REPO=https://github.com/curl/curl.git | ||
|
||
ENV CURL_VERSION ${CURL_RELEASE_VERSION} | ||
|
||
# Install dependencies | ||
RUN set -eux \ | ||
&& apk add --no-cache \ | ||
brotli \ | ||
brotli-dev \ | ||
ca-certificates \ | ||
libssh2 \ | ||
nghttp2-dev \ | ||
tzdata \ | ||
zstd \ | ||
zstd-dev \ | ||
&& rm -fr /var/cache/apk/* \ | ||
&& true | ||
|
||
# Add non privileged curl user | ||
RUN addgroup -S curl_group && adduser -S curl_user -G curl_group | ||
|
||
# Set curl CA bundle | ||
COPY --from=builder "/cacert.pem" "/cacert.pem" | ||
ENV CURL_CA_BUNDLE="/cacert.pem" | ||
|
||
# Install curl built from builder | ||
COPY --from=builder "/alpine/usr/local/lib/libcurl.so.4.8.0" "/usr/lib/" | ||
COPY --from=builder "/alpine/usr/local/bin/curl" "/usr/bin/curl" | ||
COPY --from=builder "/alpine/usr/local/include/curl" "/usr/include/curl" | ||
|
||
# Explicit libcurl symlinks | ||
RUN set -eux \ | ||
&& ln -s /usr/lib/libcurl.so.4.8.0 /usr/lib/libcurl.so.4 \ | ||
&& ln -s /usr/lib/libcurl.so.4 /usr/lib/libcurl.so \ | ||
&& true | ||
|
||
USER curl_user | ||
|
||
COPY "entrypoint.sh" "/entrypoint.sh" | ||
CMD ["curl"] | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
# Metadata | ||
LABEL org.opencontainers.image.vendor="Jose Quintana" \ | ||
org.opencontainers.image.url="https://github.com/joseluisq/alpine-curl" \ | ||
org.opencontainers.image.title="curl" \ | ||
org.opencontainers.image.description="An unofficial Curl Docker image using latest Alpine Linux." \ | ||
org.opencontainers.image.version="${VERSION}" \ | ||
org.opencontainers.image.documentation="https://github.com/joseluisq/alpine-curl" |
Oops, something went wrong.