-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
FROM golang:1.21 | ||
FROM golang:1.21 AS builder | ||
|
||
# Copy metaploy configuration | ||
COPY metaploy/heimdall.metaploy.conf / | ||
COPY metaploy/postinstall.sh / | ||
WORKDIR /src | ||
|
||
# Copy source files | ||
WORKDIR / | ||
COPY go.mod go.sum main.go mail.go / | ||
COPY go.mod go.sum ./ | ||
|
||
# Build go package | ||
RUN go build | ||
RUN go mod download | ||
|
||
# Run postinstall script and the binary | ||
CMD ["/postinstall.sh", "/heimdall"] | ||
COPY mail.go main.go ./ | ||
|
||
RUN CGO_ENABLED=1 GOOS=linux go build -o ./build --tags "fts5" -a -ldflags '-linkmode external -extldflags "-static"' . | ||
|
||
FROM alpine:latest as app | ||
|
||
RUN apk --no-cache add bash nginx ca-certificates tzdata | ||
|
||
ENV TZ="Asia/Kolkata" | ||
|
||
WORKDIR /app | ||
|
||
COPY metaploy/ ./ | ||
|
||
RUN chmod +x ./postinstall.sh | ||
|
||
COPY --from=builder /src/build . | ||
|
||
CMD ["./postinstall.sh", "./build"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
#!/bin/bash | ||
|
||
cleanup() { | ||
echo "Container stopped. Removing nginx configuration." | ||
rm /etc/nginx/sites-enabled/heimdall.metaploy.conf | ||
echo "Container stopped. Removing nginx configuration." | ||
rm /etc/nginx/sites-enabled/heimdall.metaploy.conf | ||
} | ||
|
||
trap 'cleanup' SIGQUIT SIGTERM SIGHUP | ||
|
||
"${@}" & | ||
|
||
cp /heimdall.metaploy.conf /etc/nginx/sites-enabled | ||
cp ./heimdall.metaploy.conf /etc/nginx/sites-enabled | ||
|
||
wait $! | ||
|
||
echo "lmao" |