From fb8f14fd9884ca5b5c8e802fcd768d71ab72a1de Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Mon, 28 Mar 2022 19:26:16 -0700 Subject: [PATCH] server: dockerfile updates and switch to bcryptjs --- client/.dockerignore | 9 ++++++++- client/Dockerfile | 4 +++- docker-compose.yml | 41 +++++++++++++++++++++++++++++++------- drift.sqlite | Bin 0 -> 45056 bytes server/Dockerfile | 2 ++ server/package.json | 4 ++-- server/src/routes/auth.ts | 2 +- server/yarn.lock | 26 ++++++++---------------- 8 files changed, 58 insertions(+), 30 deletions(-) create mode 100644 drift.sqlite diff --git a/client/.dockerignore b/client/.dockerignore index 40b878db..e0ef84c3 100644 --- a/client/.dockerignore +++ b/client/.dockerignore @@ -1 +1,8 @@ -node_modules/ \ No newline at end of file +Dockerfile +.dockerignore +node_modules +npm-debug.log +README.md +.next +.git +.env.* \ No newline at end of file diff --git a/client/Dockerfile b/client/Dockerfile index 5df360e7..7eeed6b7 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -20,6 +20,8 @@ COPY . . # Learn more here: https://nextjs.org/telemetry # Uncomment the following line in case you want to disable telemetry during the build. ENV NEXT_TELEMETRY_DISABLED 1 +ARG API_URL http://localhost:3000 +ARG SECRET_KEY secret RUN yarn build @@ -38,7 +40,7 @@ RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs # You only need to copy next.config.js if you are NOT using the default configuration -COPY --from=builder /app/next.config.js ./ +COPY --from=builder /app/next.config.mjs ./ COPY --from=builder /app/public ./public COPY --from=builder /app/package.json ./package.json diff --git a/docker-compose.yml b/docker-compose.yml index d6f09c16..c371926e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,23 +1,50 @@ version: '3.8' services: server: - build: ./server + build: + context: ./server + args: + SECRET_KEY: secret restart: unless-stopped user: 1000:1000 environment: - - "JWT_SECRET=change_me!" # use `openssl rand -hex 32` to generate a strong secret - - "SECRET=secret" + - JWT_SECRET=change_me! # use `openssl rand -hex 32` to generate a strong secret + - SECRET_KEY=secret expose: - 3000 + ports: + - "3000:3000" + networks: + - general + healthcheck: + test: [ "CMD", "curl", "-s", "localhost:3000"] + interval: 10s + timeout: 45s + retries: 10 + container_name: server client: - build: ./client + build: + context: ./client + network: host + args: + API_URL: http://localhost:3000 + SECRET_KEY: secret restart: unless-stopped user: 1000:1000 environment: - - "API_URL=http://localhost:3000" - - "SECRET=secret" + - API_URL=http://localhost:3000 + - SECRET_KEY=secret + ports: + - "3001:3001" expose: - 3001 + networks: + - general depends_on: server: - condition: service_completed_successfully + condition: service_healthy + container_name: client + +networks: + general: + driver: bridge diff --git a/drift.sqlite b/drift.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..a349ed9f81adbc4fa39c0dd68a0872ddbb4dd015 GIT binary patch literal 45056 zcmeI)$!^<57zc1t)M8n27{oCMBs~mJ8w%0Vrl=*B0RvSfIuE2VW*n-oCe9!U90(` zN~2eo#*CK zo4v(Hb+@?YQBTYHVy0XpM`~?QaC)M*m;e5hqWEYvC>(9EjMXvBm-h1({q^j+cD?2L zs9!xcx)gbJKNJ!Kf&FpaOURkkGHvf=WjqC5Y^FWYj`Jl=B_mf#ugtNWmf0XrGUe=H zruyQ#44*z11ZjvTKK?nVuRcR8OV zD}x<|u??RuF30Nby$MM-49UIMLHEDQ(oN+-c(~~*El+^|$?gCD!T-kpOlL7c00Izz z00bZa0SG_<0uX=z1R!vO0-tdE?7Y5zV1wIXr#k=sdz{2h_Wn76i?cJj|Gsrj3QzX` z-SK~xFEaFj2?7v+00bZa0SG_<0uX=z1Rwx`4-x3gY*>5H59IUA#%?^_)Z?+FWF%8b zDe)+=D>aq0A*E8ycp{NXr;S+CF>S}{oNp@nW=!5x4qw{2-s8uLd75s2-8rkK)N0}+ zo4PpfmX4a+=OsCzbf20png=^iYqip0r?z{RRb)kxIQqf>AUGKmY;|fB*y_009U<00Izz02RRa zKdJ!)AOHafKmY;|fB*y_009U