Task: Add docker container inside alpine linux for docker image and github workflows

This commit is contained in:
Sambo Chea 2021-07-14 14:43:18 +07:00
commit 4a987fb30e
7 changed files with 161 additions and 0 deletions

27
.github/workflows/docker-publish.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Docker CI
on:
push:
branches: [ main ]
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_SECRET }}
-
name: Checkout
uses: actions/checkout@v2
-
name: Build and Push from Makefile
run: |
make build

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.dccache

52
Dockerfile Normal file
View File

@ -0,0 +1,52 @@
FROM cubetiq/calpine-os-linux:latest
LABEL maintainer="sombochea@cubetiqs.com"
RUN apk add --no-cache \
ca-certificates \
openssh-client
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
ENV DOCKER_VERSION 20.10.7
RUN set -eux; \
\
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
'x86_64') \
url='https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz'; \
;; \
'armhf') \
url='https://download.docker.com/linux/static/stable/armel/docker-${DOCKER_VERSION}.tgz'; \
;; \
'armv7') \
url='https://download.docker.com/linux/static/stable/armhf/docker-${DOCKER_VERSION}.tgz'; \
;; \
'aarch64') \
url='https://download.docker.com/linux/static/stable/aarch64/docker-${DOCKER_VERSION}.tgz'; \
;; \
*) echo >&2 "error: unsupported architecture ($apkArch)"; exit 1 ;; \
esac; \
\
wget -O docker.tgz "$url"; \
\
tar --extract \
--file docker.tgz \
--strip-components 1 \
--directory /usr/local/bin/ \
; \
rm docker.tgz; \
\
dockerd --version; \
docker --version
COPY modprobe.sh /usr/local/bin/modprobe
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/modprobe
ENV DOCKER_TLS_CERTDIR=/certs
RUN mkdir /certs /certs/client && chmod 1777 /certs /certs/client
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["sh"]

13
Makefile Normal file
View File

@ -0,0 +1,13 @@
DOCKER_IMAGE=cubetiq/calpine-docker
DOCKER_IMAGE_NAME=${DOCKER_IMAGE}:20.10.7
build:
@echo 'Starting docker build'
docker build . -t ${DOCKER_IMAGE}
@echo 'Starting docker push'
docker tag ${DOCKER_IMAGE} ${DOCKER_IMAGE_NAME}
docker push ${DOCKER_IMAGE}
docker push ${DOCKER_IMAGE_NAME}
.PHONY:build

56
README.md Normal file
View File

@ -0,0 +1,56 @@
# CUBETIQ Alpine OS Linux with Docker 20.10.7
![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/cubetiq/calpine-docker)
![Docker Pulls](https://img.shields.io/docker/pulls/cubetiq/calpine-docker)
- CUBETIQ Alpine OS Linux (3.13.3)
- Docker (20.10.7)
# [Docker Hub](https://hub.docker.com/r/cubetiq/calpine-docker)
```shell
docker push cubetiq/calpine-docker
```
# Usage
```shell
docker run --rm -it cubetiq/calpine-docker /bin/sh
```
# Example
```Dockerfile
FROM cubetiq/calpine-docker:latest
LABEL maintainer="sombochea@cubetiqs.com"
RUN docker version
CMD [ "sh" ]
```
# Reference
- Docker: [GitHub](https://github.com/docker-library/docker/tree/279ba9c93e8e26a15171645bd511ea8476c4706e/20.10)
# Contributors
- Sambo Chea <sombochea@cubetiqs.com>
# License
```text
MIT License
Copyright (c) 2018-2020 Dave Hall <skwashd@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECT
```

0
docker-entrypoint.sh Normal file
View File

12
modprobe.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -eu
for module; do
if [ "${module#-}" = "$module" ]; then
ip link show "$module" || true
lsmod | grep "$module" || true
fi
done
export PATH='/usr/sbin:/usr/bin:/sbin:/bin'
exec modprobe "$@"