Compare commits
2 Commits
pkg/dev/ub
...
staging
Author | SHA1 | Date | |
---|---|---|---|
19e15d3fe7 | |||
db0a3ac98f |
@ -5,4 +5,5 @@
|
||||
/bin
|
||||
/misc/docker/Dockerfile
|
||||
/.env
|
||||
/.env.dist
|
||||
/.env.dist
|
||||
/tools
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,4 +3,5 @@
|
||||
/vendor
|
||||
/bin
|
||||
/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:
|
||||
CGO_ENABLED=0 go build -v -o bin/fake-smtp ./cmd/fake-smtp
|
||||
@ -31,7 +41,7 @@ docker-release:
|
||||
test:
|
||||
go test -v -race ./...
|
||||
|
||||
release: dist
|
||||
release: dist tools
|
||||
@./misc/script/release.sh
|
||||
|
||||
dist:
|
||||
|
1
debian/compat
vendored
1
debian/compat
vendored
@ -1 +0,0 @@
|
||||
9
|
14
debian/control
vendored
14
debian/control
vendored
@ -1,14 +0,0 @@
|
||||
Source: fake-smtp
|
||||
Section: unknown
|
||||
Priority: optional
|
||||
Maintainer: William Petit <wpetit@cadoles.com>
|
||||
Build-Depends: debhelper (>= 8.0.0), wget, ca-certificates, tar, curl
|
||||
Standards-Version: 3.9.4
|
||||
Homepage: http://forge.cadoles.com/wpetit/fake-smtp
|
||||
Vcs-Git: http://forge.cadoles.com/wpetit/fake-smtp.git
|
||||
Vcs-Browser: http://forge.cadoles.com/wpetit/fake-smtp
|
||||
|
||||
Package: fake-smtp
|
||||
Architecture: amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Serveur SMTP factice pour le développement avec interface web
|
1
debian/fake-smtp.dirs
vendored
1
debian/fake-smtp.dirs
vendored
@ -1 +0,0 @@
|
||||
var/lib/fake-smtp
|
11
debian/fake-smtp.service
vendored
11
debian/fake-smtp.service
vendored
@ -1,11 +0,0 @@
|
||||
[Unit]
|
||||
Description=Serveur SMTP factice pour le développement avec interface web
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/fake-smtp -workdir /usr/share/fake-smtp -config /etc/fake-smtp/config.yml
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
54
debian/rules
vendored
54
debian/rules
vendored
@ -1,54 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
export DH_VERBOSE=1
|
||||
|
||||
GO_VERSION := 1.14.2
|
||||
OS := linux
|
||||
ARCH := amd64
|
||||
GOPATH=$(HOME)/go
|
||||
|
||||
ifeq (, $(shell which go 2>/dev/null))
|
||||
override_dh_auto_build: install-go
|
||||
endif
|
||||
|
||||
ifeq (, $(shell which node 2>/dev/null))
|
||||
override_dh_auto_build: install-nodejs
|
||||
endif
|
||||
|
||||
%:
|
||||
dh $@ --with systemd
|
||||
|
||||
override_dh_auto_build: $(GOPATH)
|
||||
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" make tooling
|
||||
npm install
|
||||
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" go mod vendor
|
||||
GOPATH=$(GOPATH) PATH="$(PATH):/usr/local/go/bin:$(GOPATH)/bin" ARCH_TARGETS=$(ARCH) make release
|
||||
|
||||
$(GOPATH):
|
||||
mkdir -p $(GOPATH)
|
||||
|
||||
install-go:
|
||||
wget https://dl.google.com/go/go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
|
||||
tar -C /usr/local -xzf go$(GO_VERSION).$(OS)-$(ARCH).tar.gz
|
||||
|
||||
install-nodejs:
|
||||
curl -sL https://deb.nodesource.com/setup_13.x | bash -
|
||||
apt-get install -y nodejs
|
||||
|
||||
override_dh_auto_install:
|
||||
mkdir -p debian/fake-smtp/usr/share/fake-smtp
|
||||
mkdir -p debian/fake-smtp/etc/fake-smtp
|
||||
mkdir -p debian/fake-smtp/usr/bin
|
||||
|
||||
cp -r release/fake-smtp-$(OS)-$(ARCH)/* debian/fake-smtp/usr/share/fake-smtp/
|
||||
|
||||
mv debian/fake-smtp/usr/share/fake-smtp/bin/fake-smtp debian/fake-smtp/usr/bin/fake-smtp
|
||||
mv debian/fake-smtp/usr/share/fake-smtp/config.yml debian/fake-smtp/etc/fake-smtp/config.yml
|
||||
|
||||
install -d debian/fake-smtp
|
||||
|
||||
override_dh_strip:
|
||||
|
||||
override_dh_auto_test:
|
1
debian/source/format
vendored
1
debian/source/format
vendored
@ -1 +0,0 @@
|
||||
3.0 (native)
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.17 AS build
|
||||
FROM golang:1.19 AS build
|
||||
|
||||
ARG HTTP_PROXY=
|
||||
ARG HTTPS_PROXY=
|
||||
@ -14,13 +14,8 @@ COPY . /src
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
RUN cp -f misc/docker/config-patch.yml misc/release/config-patch.yml
|
||||
|
||||
RUN go get github.com/krishicks/yaml-patch/cmd/yaml-patch
|
||||
|
||||
RUN npm install \
|
||||
&& make vendor \
|
||||
&& echo "---" > ./misc/release/config-patch.yml \
|
||||
RUN cp -f misc/docker/config-patch.txt misc/release/config-patch.txt \
|
||||
&& npm install \
|
||||
&& make ARCH_TARGETS=amd64 release
|
||||
|
||||
FROM busybox
|
||||
@ -31,4 +26,6 @@ WORKDIR /app
|
||||
|
||||
RUN mkdir -p /app
|
||||
|
||||
EXPOSE 8080 2525
|
||||
|
||||
CMD ["bin/fake-smtp", "--config", "config.yml"]
|
1
misc/docker/config-patch.txt
Normal file
1
misc/docker/config-patch.txt
Normal file
@ -0,0 +1 @@
|
||||
.smtp.debug = false
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
- op: replace
|
||||
path: /smtp/debug
|
||||
value: false
|
3
misc/release/config-patch.txt
Normal file
3
misc/release/config-patch.txt
Normal file
@ -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 os=$2
|
||||
local arch=$3
|
||||
local tmp_conf=$(mktemp)
|
||||
local patched_conf=$(mktemp)
|
||||
|
||||
go run "$PROJECT_DIR/cmd/$command" -dump-config > "$tmp_conf"
|
||||
cat "$tmp_conf" | yaml-patch -o misc/release/config-patch.yml > "$patched_conf"
|
||||
go run "$PROJECT_DIR/cmd/$command" -dump-config > "$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"
|
||||
rm -f "$tmp_conf" "$patched_conf"
|
||||
rm -f "$patched_conf"
|
||||
}
|
||||
|
||||
function compress {
|
||||
|
Reference in New Issue
Block a user