mirror of
https://github.com/wiggin77/mailrelay.git
synced 2024-11-22 07:13:08 +01:00
dockerizing
This commit is contained in:
parent
fd213dd450
commit
b23950eed9
30
Dockerfile
Normal file
30
Dockerfile
Normal file
@ -0,0 +1,30 @@
|
||||
# Dockerfile References: https://docs.docker.com/engine/reference/builder/
|
||||
|
||||
# Start from the latest golang base image
|
||||
FROM golang:latest as builder
|
||||
|
||||
# Set the Current Working Directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy go mod and sum files
|
||||
COPY src/* ./
|
||||
|
||||
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
|
||||
RUN go mod download
|
||||
|
||||
# Build the Go app
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
|
||||
|
||||
|
||||
######## Start a new stage from scratch #######
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk --no-cache add ca-certificates
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
# Copy the Pre-built binary file from the previous stage
|
||||
COPY --from=builder /app/main .
|
||||
|
||||
# Command to run the executable
|
||||
CMD ["./main"]
|
@ -77,6 +77,15 @@ sudo systemctl enable mailrelay
|
||||
|
||||
Now `mailrelay` runs as a service daemon and will automatically start after reboot.
|
||||
|
||||
## Example 3 (Docker)
|
||||
|
||||
edit mailrelay.json as needed then build container and run it
|
||||
|
||||
```
|
||||
docker build -t mailrelay .
|
||||
docker run -v $PWD/mailrelay.json:/etc/mailrelay.json mailrelay
|
||||
```
|
||||
|
||||
## Feedback
|
||||
|
||||
Send any questions or comments to wiggin77@warpmail.net
|
@ -3,7 +3,7 @@
|
||||
"smtp_port": 465,
|
||||
"smtp_username": "username@fastmail.com",
|
||||
"smtp_password": "secret_app_password",
|
||||
"local_listen_port": 2525,
|
||||
"local_listen_ip": "0.0.0.0"
|
||||
"local_listen_port": 25,
|
||||
"local_listen_ip": "0.0.0.0",
|
||||
"allowed_hosts": ["*"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user