Change docker image
This commit is contained in:
parent
694c4ff93c
commit
8f3eaa6e2f
3 changed files with 34 additions and 11 deletions
17
Dockerfile
17
Dockerfile
|
@ -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
11
docker_test.sh
Executable 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
17
sendmail.sh
Executable 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
|
Loading…
Reference in a new issue