Skip to content

Commit 0e5fc97

Browse files
committed
feat: improvised docker build
1 parent 7c7bfde commit 0e5fc97

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

backend/Dockerfile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ RUN go mod download
88

99
COPY . .
1010

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

13-
FROM busybox:1.36-musl
13+
FROM alpine:latest AS app
1414

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

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

19-
COPY metaploy/naarad-api.metaploy.conf /
19+
WORKDIR /app
2020

21-
COPY metaploy/postinstall.sh /
21+
COPY metaploy/ ./
2222

23-
RUN chmod +x /postinstall.sh
23+
RUN chmod +x ./postinstall.sh
2424

25-
COPY --from=builder /app /app
25+
COPY --from=builder /src/build .
2626

27-
CMD ["/postinstall.sh", "/app"]
27+
CMD ["./postinstall.sh", "./build"]

backend/metaploy/postinstall.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
#!/bin/sh
22

33
cleanup() {
4-
echo "Container stopped. Removing nginx configuration."
5-
rm /etc/nginx/sites-enabled/naarad-api.metaploy.conf
4+
echo "Container stopped. Removing nginx configuration."
5+
rm /etc/nginx/sites-enabled/naarad-api.metaploy.conf
66
}
77

88
trap 'cleanup' SIGQUIT SIGTERM SIGHUP
99

1010
"${@}" &
1111

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

1414
wait $!
15-
16-
echo "lmao"

0 commit comments

Comments
 (0)