Skip to content

Commit

Permalink
fix: docker run api
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroFnseca committed Aug 31, 2023
1 parent fe22372 commit aa608a6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
Binary file modified bin/main
Binary file not shown.
10 changes: 1 addition & 9 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Use uma imagem de base com suporte para compilação C
FROM gcc:latest

# Instale as dependências necessárias
RUN apt-get update && \
apt-get install -y libmicrohttpd-dev make nginx libpq-dev

Expand All @@ -11,14 +9,8 @@ WORKDIR /app

COPY . /app

RUN ./build.sh

COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 80

CMD nginx -g "daemon off;"

RUN ./bin/main

# Rever execução do ./bin/main
CMD service nginx start && ./main_run.sh
3 changes: 2 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ int main() {
if (!daemon)
return 1;

getchar();
while (1)
sleep(1);

MHD_stop_daemon(daemon);

Expand Down
10 changes: 5 additions & 5 deletions src/pg.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#include <string.h>
#include <libpq-fe.h>

#define database "*****"
#define user "*****"
#define password "*****"
#define host "*****"
#define port "*****"
#define database "postgres"
#define user "postgres"
#define password "rest-api-c-123"
#define host "db.lkpuboamwslpkjbywsbi.supabase.co"
#define port "5432"

char *executeQueryToJson(const char *query);

Expand Down

0 comments on commit aa608a6

Please sign in to comment.