Change docker image

This commit is contained in:
sfigato 2020-04-29 09:49:24 +02:00
parent 694c4ff93c
commit 8f3eaa6e2f
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
3 changed files with 34 additions and 11 deletions

View File

@ -1,4 +1,4 @@
FROM golang:1.13 AS builder
FROM golang:1.14 AS builder
WORKDIR /app
COPY go.mod go.sum /app/
@ -6,18 +6,13 @@ RUN go mod download
COPY *go /app/
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -tags netgo -o /sendmail ./...
FROM busybox:latest AS shell
FROM gcr.io/distroless/static
ENV sm_server ""
ENV sm_port "465"
ENV sm_user ""
ENV sm_password ""
ENV sm_from ""
ENV sm_to ""
ENV sm_sub ""
COPY --from=builder /sendmail /
WORKDIR /
COPY --from=builder /sendmail /
COPY --from=shell /bin/cat /bin/date /bin/sh /bin/
COPY sendmail.sh /sendmail.sh
ENTRYPOINT ["/sendmail"]
ENTRYPOINT ["/sendmail.sh"]

11
docker_test.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
docker run \
-e M_SERVER_ADDRESS=smtp.autistici.org \
-e M_USER=problemi.ma@anche.no \
-e M_PASSWORD=$(pass personal/ai/otp/mail/sendmail-stakhanov) \
-e M_FROM=blallo@autistici.org \
-e M_TO=blallo@riseup.net \
-e M_SUB="test mail from docker image" \
-e M_TEXT="Test from docker image" \
-ti leophys/sendmail:latest

17
sendmail.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
cat << EOM | /sendmail \
-server-address=${M_SERVER_ADDRESS} \
-server-port=465 \
-user=${M_USER} \
-password=${M_PASSWORD} \
-from=${M_FROM} \
-to=${M_TO} \
-sub="${M_SUB}"
$(date +%Y-%m-%d_%H:%M)
---
${M_TEXT}
EOM