diff --git a/backend/Dockerfile b/backend/Dockerfile index 4dfbf6e..8ff2c9e 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -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"] \ No newline at end of file +CMD ["./postinstall.sh", "./build"] \ No newline at end of file diff --git a/backend/metaploy/postinstall.sh b/backend/metaploy/postinstall.sh index 698aba6..56eb8fe 100644 --- a/backend/metaploy/postinstall.sh +++ b/backend/metaploy/postinstall.sh @@ -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" \ No newline at end of file