Fix docker build recipe
This commit is contained in:
parent
db0a3ac98f
commit
19e15d3fe7
|
@ -6,3 +6,4 @@
|
||||||
/misc/docker/Dockerfile
|
/misc/docker/Dockerfile
|
||||||
/.env
|
/.env
|
||||||
/.env.dist
|
/.env.dist
|
||||||
|
/tools
|
|
@ -4,3 +4,4 @@
|
||||||
/bin
|
/bin
|
||||||
/node_modules
|
/node_modules
|
||||||
/.env
|
/.env
|
||||||
|
/tools
|
14
Makefile
14
Makefile
|
@ -1,4 +1,14 @@
|
||||||
DOCKER_DATE_TAG := $(shell date +%Y%m%d%H%M)
|
DOCKER_DATE_TAG := $(shell date --utc +%Y.%-m.%-d%-H%-M)
|
||||||
|
|
||||||
|
YQ_VERSION ?= v4.30.4
|
||||||
|
YQ_BINARY ?= yq_linux_amd64
|
||||||
|
|
||||||
|
tools: tools/yq/bin/yq
|
||||||
|
|
||||||
|
tools/yq/bin/yq:
|
||||||
|
mkdir -p tools/yq/bin
|
||||||
|
wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY} -O tools/yq/bin/yq &&\
|
||||||
|
chmod +x tools/yq/bin/yq
|
||||||
|
|
||||||
build:
|
build:
|
||||||
CGO_ENABLED=0 go build -v -o bin/fake-smtp ./cmd/fake-smtp
|
CGO_ENABLED=0 go build -v -o bin/fake-smtp ./cmd/fake-smtp
|
||||||
|
@ -31,7 +41,7 @@ docker-release:
|
||||||
test:
|
test:
|
||||||
go test -v -race ./...
|
go test -v -race ./...
|
||||||
|
|
||||||
release: dist
|
release: dist tools
|
||||||
@./misc/script/release.sh
|
@./misc/script/release.sh
|
||||||
|
|
||||||
dist:
|
dist:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM golang:1.17 AS build
|
FROM golang:1.19 AS build
|
||||||
|
|
||||||
ARG HTTP_PROXY=
|
ARG HTTP_PROXY=
|
||||||
ARG HTTPS_PROXY=
|
ARG HTTPS_PROXY=
|
||||||
|
@ -14,13 +14,8 @@ COPY . /src
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
RUN cp -f misc/docker/config-patch.yml misc/release/config-patch.yml
|
RUN cp -f misc/docker/config-patch.txt misc/release/config-patch.txt \
|
||||||
|
&& npm install \
|
||||||
RUN go get github.com/krishicks/yaml-patch/cmd/yaml-patch
|
|
||||||
|
|
||||||
RUN npm install \
|
|
||||||
&& make vendor \
|
|
||||||
&& echo "---" > ./misc/release/config-patch.yml \
|
|
||||||
&& make ARCH_TARGETS=amd64 release
|
&& make ARCH_TARGETS=amd64 release
|
||||||
|
|
||||||
FROM busybox
|
FROM busybox
|
||||||
|
@ -31,4 +26,6 @@ WORKDIR /app
|
||||||
|
|
||||||
RUN mkdir -p /app
|
RUN mkdir -p /app
|
||||||
|
|
||||||
|
EXPOSE 8080 2525
|
||||||
|
|
||||||
CMD ["bin/fake-smtp", "--config", "config.yml"]
|
CMD ["bin/fake-smtp", "--config", "config.yml"]
|
|
@ -0,0 +1 @@
|
||||||
|
.smtp.debug = false
|
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
- op: replace
|
|
||||||
path: /smtp/debug
|
|
||||||
value: false
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
.data.path = "/var/lib/fake-smtp/data.db"
|
||||||
|
.smtp.address = "127.0.0.1:2525"
|
||||||
|
.smtp.debug = false
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
- op: replace
|
|
||||||
path: /data/path
|
|
||||||
value: /var/lib/fake-smtp/data.db
|
|
||||||
- op: replace
|
|
||||||
path: /smtp/address
|
|
||||||
value: 127.0.0.1:2525
|
|
||||||
- op: replace
|
|
||||||
path: /smtp/debug
|
|
||||||
value: false
|
|
|
@ -73,13 +73,17 @@ function dump_default_conf {
|
||||||
local command=$1
|
local command=$1
|
||||||
local os=$2
|
local os=$2
|
||||||
local arch=$3
|
local arch=$3
|
||||||
local tmp_conf=$(mktemp)
|
|
||||||
local patched_conf=$(mktemp)
|
local patched_conf=$(mktemp)
|
||||||
|
|
||||||
go run "$PROJECT_DIR/cmd/$command" -dump-config > "$tmp_conf"
|
go run "$PROJECT_DIR/cmd/$command" -dump-config > "$patched_conf"
|
||||||
cat "$tmp_conf" | yaml-patch -o misc/release/config-patch.yml > "$patched_conf"
|
|
||||||
|
while IFS= read -r yq_cmd; do
|
||||||
|
echo "patching configuration with '$yq_cmd'..."
|
||||||
|
tools/yq/bin/yq -i "$yq_cmd" "$patched_conf"
|
||||||
|
done < misc/release/config-patch.txt
|
||||||
|
|
||||||
copy "$command" $os $arch "$patched_conf" "config.yml"
|
copy "$command" $os $arch "$patched_conf" "config.yml"
|
||||||
rm -f "$tmp_conf" "$patched_conf"
|
rm -f "$patched_conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
function compress {
|
function compress {
|
||||||
|
|
Loading…
Reference in New Issue