mirror of
https://github.com/chaifeng/ufw-docker.git
synced 2025-05-11 05:48:31 +02:00
Compare commits
No commits in common. "master" and "221002-nf_tables" have entirely different histories.
master
...
221002-nf_
6 changed files with 18 additions and 75 deletions
35
.github/workflows/build.yml
vendored
35
.github/workflows/build.yml
vendored
|
@ -1,35 +0,0 @@
|
||||||
name: Build Images
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Log into DockerHub
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ github.actor }}/ufw-docker-agent
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
platforms: linux/amd64,linux/arm64/v8
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
|
@ -1,6 +1,6 @@
|
||||||
FROM ubuntu:24.04
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
ARG docker_version="27.3.1"
|
ARG docker_version="20.10.17"
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
|
@ -12,7 +12,8 @@ RUN apt-get update \
|
||||||
| tee /etc/apt/sources.list.d/docker.list > /dev/null \
|
| tee /etc/apt/sources.list.d/docker.list > /dev/null \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends locales ufw \
|
&& apt-get install -y --no-install-recommends locales ufw \
|
||||||
&& apt-get install -y --no-install-recommends "docker-ce=$(apt-cache madison docker-ce | grep -m1 -F "${docker_version}" | cut -d'|' -f2 | tr -d '[[:blank:]]')" \
|
&& ( apt-get install -y --no-install-recommends "docker-ce=5:${docker_version}~*" || \
|
||||||
|
apt-get install -y --no-install-recommends "docker-ce=${docker_version}~*" ) \
|
||||||
&& locale-gen en_US.UTF-8 \
|
&& locale-gen en_US.UTF-8 \
|
||||||
&& apt-get clean autoclean \
|
&& apt-get clean autoclean \
|
||||||
&& apt-get autoremove --yes \
|
&& apt-get autoremove --yes \
|
||||||
|
|
15
Vagrantfile
vendored
15
Vagrantfile
vendored
|
@ -6,15 +6,16 @@
|
||||||
ENV['VAGRANT_NO_PARALLEL']="true"
|
ENV['VAGRANT_NO_PARALLEL']="true"
|
||||||
|
|
||||||
Vagrant.configure('2') do |config|
|
Vagrant.configure('2') do |config|
|
||||||
|
|
||||||
|
docker_version = "20.10.17"
|
||||||
|
|
||||||
ubuntu_version = File.readlines("Dockerfile").filter { |line|
|
ubuntu_version = File.readlines("Dockerfile").filter { |line|
|
||||||
line.start_with?("FROM ")
|
line.start_with?("FROM ")
|
||||||
}.first.match(/\d\d\.\d\d/)[0]
|
}.first.match(/\d\d\.\d\d/)[0]
|
||||||
|
|
||||||
docker_version = File.readlines("Dockerfile").filter { |line|
|
config.vm.box = "chaifeng/ubuntu-#{ubuntu_version}-docker-#{docker_version}#{(`uname -m`.strip == "arm64")?"-arm64":""}"
|
||||||
line.start_with?("ARG docker_version=")
|
|
||||||
}.first.match(/"([\d\.]+)"/)[1]
|
|
||||||
|
|
||||||
config.vm.box = "chaifeng/ubuntu-#{ubuntu_version}-docker-#{docker_version}"
|
#config.vm.box = "chaifeng/ubuntu-20.04-docker-20.10.17#{(`uname -m`.strip == "arm64")?"-arm64":""}"
|
||||||
|
|
||||||
config.vm.provider 'virtualbox' do |vb|
|
config.vm.provider 'virtualbox' do |vb|
|
||||||
vb.memory = '1024'
|
vb.memory = '1024'
|
||||||
|
@ -177,7 +178,6 @@ DOCKERFILE
|
||||||
|
|
||||||
ufw-docker service allow public_service 80/tcp
|
ufw-docker service allow public_service 80/tcp
|
||||||
|
|
||||||
docker service inspect "public_multiport" ||
|
|
||||||
docker service create --name "public_multiport" \
|
docker service create --name "public_multiport" \
|
||||||
--publish "40080:80" --publish "47000:7000" --publish "48080:8080" \
|
--publish "40080:80" --publish "47000:7000" --publish "48080:8080" \
|
||||||
--env name="public_multiport" --replicas 3 #{private_registry}/chaifeng/hostname-webapp
|
--env name="public_multiport" --replicas 3 #{private_registry}/chaifeng/hostname-webapp
|
||||||
|
@ -202,11 +202,6 @@ DOCKERFILE
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.define "node-internal" do |node|
|
|
||||||
node.vm.hostname = "node-internal"
|
|
||||||
node.vm.network "private_network", ip: "#{ip_prefix}.142"
|
|
||||||
end
|
|
||||||
|
|
||||||
config.vm.define "external" do |external|
|
config.vm.define "external" do |external|
|
||||||
external.vm.hostname = "external"
|
external.vm.hostname = "external"
|
||||||
external.vm.network "private_network", ip: "#{ip_prefix}.127"
|
external.vm.network "private_network", ip: "#{ip_prefix}.127"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 27885eb79c11e4652dede994c886ae5f9e30994f
|
Subproject commit 447edb60db232d3dbc2267f37c49bd7a070cc83d
|
|
@ -15,10 +15,7 @@ source "$working_dir"/bach/bach.sh
|
||||||
@mock iptables --version
|
@mock iptables --version
|
||||||
@mocktrue grep -F '(legacy)'
|
@mocktrue grep -F '(legacy)'
|
||||||
|
|
||||||
@mocktrue docker -v
|
@ignore remove_blank_lines
|
||||||
@mock docker -v === @stdout Docker version 0.0.0, build dummy
|
|
||||||
|
|
||||||
@mockpipe remove_blank_lines
|
|
||||||
@ignore echo
|
@ignore echo
|
||||||
@ignore err
|
@ignore err
|
||||||
|
|
||||||
|
@ -101,17 +98,6 @@ test-ufw-is-disabled-assert() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
test-docker-is-installed() {
|
|
||||||
@mockfalse docker -v
|
|
||||||
|
|
||||||
ufw-docker
|
|
||||||
}
|
|
||||||
test-docker-is-installed-assert() {
|
|
||||||
die "Docker executable not found."
|
|
||||||
ufw-docker--help
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
test-ufw-docker-status() {
|
test-ufw-docker-status() {
|
||||||
ufw-docker status
|
ufw-docker status
|
||||||
}
|
}
|
||||||
|
@ -465,7 +451,7 @@ test-ufw-docker--instance-name-found-a-name() {
|
||||||
}
|
}
|
||||||
test-ufw-docker--instance-name-found-a-name-assert() {
|
test-ufw-docker--instance-name-found-a-name-assert() {
|
||||||
docker inspect --format="{{.Name}}" foo
|
docker inspect --format="{{.Name}}" foo
|
||||||
@dryrun echo -n foo
|
echo -n foo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -557,7 +543,7 @@ test-ufw-docker--list-number-assert() {
|
||||||
|
|
||||||
test-ufw-docker--delete-empty-result() {
|
test-ufw-docker--delete-empty-result() {
|
||||||
@mock ufw-docker--list-number webapp 80 tcp === @stdout ""
|
@mock ufw-docker--list-number webapp 80 tcp === @stdout ""
|
||||||
@mockpipe sort -rn
|
@mock sort -rn
|
||||||
|
|
||||||
load-ufw-docker-function ufw-docker--delete
|
load-ufw-docker-function ufw-docker--delete
|
||||||
ufw-docker--delete webapp 80 tcp
|
ufw-docker--delete webapp 80 tcp
|
||||||
|
@ -569,7 +555,7 @@ test-ufw-docker--delete-empty-result-assert() {
|
||||||
|
|
||||||
test-ufw-docker--delete-all() {
|
test-ufw-docker--delete-all() {
|
||||||
@mock ufw-docker--list-number webapp 80 tcp === @stdout 5 8 9
|
@mock ufw-docker--list-number webapp 80 tcp === @stdout 5 8 9
|
||||||
@mockpipe sort -rn
|
@mock sort -rn
|
||||||
|
|
||||||
load-ufw-docker-function ufw-docker--delete
|
load-ufw-docker-function ufw-docker--delete
|
||||||
ufw-docker--delete webapp 80 tcp
|
ufw-docker--delete webapp 80 tcp
|
||||||
|
|
|
@ -5,7 +5,7 @@ set -euo pipefail
|
||||||
LANG=en_US.UTF-8
|
LANG=en_US.UTF-8
|
||||||
LANGUAGE=en_US:
|
LANGUAGE=en_US:
|
||||||
LC_ALL=en_US.UTF-8
|
LC_ALL=en_US.UTF-8
|
||||||
PATH="/bin:/usr/bin:/sbin:/usr/sbin:/snap/bin/"
|
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
|
||||||
|
|
||||||
GREP_REGEXP_INSTANCE_NAME="[-_.[:alnum:]]\\+"
|
GREP_REGEXP_INSTANCE_NAME="[-_.[:alnum:]]\\+"
|
||||||
DEFAULT_PROTO=tcp
|
DEFAULT_PROTO=tcp
|
||||||
|
@ -424,10 +424,6 @@ if ! ufw status 2>/dev/null | grep -Fq "Status: active" ; then
|
||||||
die "UFW is disabled or you are not root user, or mismatched iptables legacy/nf_tables, current $(iptables --version)"
|
die "UFW is disabled or you are not root user, or mismatched iptables legacy/nf_tables, current $(iptables --version)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! docker -v &> /dev/null; then
|
|
||||||
die "Docker executable not found."
|
|
||||||
fi
|
|
||||||
|
|
||||||
ufw_action="${1:-help}"
|
ufw_action="${1:-help}"
|
||||||
|
|
||||||
case "$ufw_action" in
|
case "$ufw_action" in
|
||||||
|
|
Loading…
Add table
Reference in a new issue