Skip to content

Commit

Permalink
feat: improvised docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
proffapt committed Jul 4, 2024
1 parent 7c7bfde commit 0e5fc97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
18 changes: 9 additions & 9 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ RUN go mod download

COPY . .

RUN CGO_ENABLED=1 GOOS=linux go build -o /app --tags "fts5" -a -ldflags '-linkmode external -extldflags "-static"' .
RUN CGO_ENABLED=1 GOOS=linux go build -o ./build -a -ldflags '-linkmode external -extldflags "-static"'

FROM busybox:1.36-musl
FROM alpine:latest AS app

RUN mkdir -p /etc/ssl/certs
RUN apk --no-cache add ca-certificates tzdata bash

COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
ENV TZ="Asia/Kolkata"

COPY metaploy/naarad-api.metaploy.conf /
WORKDIR /app

COPY metaploy/postinstall.sh /
COPY metaploy/ ./

RUN chmod +x /postinstall.sh
RUN chmod +x ./postinstall.sh

COPY --from=builder /app /app
COPY --from=builder /src/build .

CMD ["/postinstall.sh", "/app"]
CMD ["./postinstall.sh", "./build"]
8 changes: 3 additions & 5 deletions backend/metaploy/postinstall.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/bin/sh

cleanup() {
echo "Container stopped. Removing nginx configuration."
rm /etc/nginx/sites-enabled/naarad-api.metaploy.conf
echo "Container stopped. Removing nginx configuration."
rm /etc/nginx/sites-enabled/naarad-api.metaploy.conf
}

trap 'cleanup' SIGQUIT SIGTERM SIGHUP

"${@}" &

cp /naarad-api.metaploy.conf /etc/nginx/sites-enabled
cp ./naarad-api.metaploy.conf /etc/nginx/sites-enabled

wait $!

echo "lmao"

0 comments on commit 0e5fc97

Please sign in to comment.