Skip to content

Commit

Permalink
feat: improve heroku setup
Browse files Browse the repository at this point in the history
  • Loading branch information
froid1911 committed Jan 29, 2024
1 parent 11fc60e commit d6fdd6e
Show file tree
Hide file tree
Showing 10 changed files with 9,328 additions and 6,643 deletions.
4 changes: 1 addition & 3 deletions api/Dockerfile → api/Dockerfile.api
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ARG NODE_VERSION=node:16.14.2

FROM $NODE_VERSION AS dependency-base
ENV PORT=$PORT
ENV PORT=3000
ENV DATABASE_URL=$DATABASE_URL
ENV JWT_SECRET=$JWT_SECRET
ENV AUTH_SIGNUP_ENABLED=$AUTH_SIGNUP_ENABLED
Expand All @@ -15,8 +15,6 @@ WORKDIR /app
# copy the app, note .dockerignore
COPY package.json .
COPY yarn.lock .
COPY Procfile .
COPY heroku.yml .
RUN yarn install --frozen-lockfile

FROM dependency-base AS production
Expand Down
5 changes: 0 additions & 5 deletions api/heroku.yml

This file was deleted.

11 changes: 6 additions & 5 deletions api/src/env/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import dotenv from 'dotenv';
import { getJwtSecret, getJwtExpirationPeriod } from './getters';
import dotenv from "dotenv";
import { getJwtSecret, getJwtExpirationPeriod } from "./getters";

dotenv.config();

export const JWT_SECRET = getJwtSecret();
export const PORT = Number(process.env.PORT ?? '3001');
export const isDevelopment = process.env.NODE_ENV === 'development';
export const PORT = 3000;
export const isDevelopment = process.env.NODE_ENV === "development";
export const AUTH_SIGNUP_ENABLED = Boolean(process.env.AUTH_SIGNUP_ENABLED);
export const JWT_EXPIRATION_PERIOD: string = getJwtExpirationPeriod();
export const API_ORIGIN = process.env.API_ORIGIN || `http://0.0.0.0:${PORT}`;
export const API_GQL_ENDPOINT = process.env.API_GQL_ENDPOINT || `${API_ORIGIN}/graphql`;
export const API_GQL_ENDPOINT =
process.env.API_GQL_ENDPOINT || `${API_ORIGIN}/graphql`;
40 changes: 20 additions & 20 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,27 @@ services:
database:
condition: service_healthy

frontend:
restart: unless-stopped
build:
context: .
dockerfile: ./frontend/Dockerfile
expose:
- 3000
# frontend:
# restart: unless-stopped
# build:
# context: .
# dockerfile: ./frontend/Dockerfile
# expose:
# - 3000

wundergraph:
platform: linux/amd64
restart: unless-stopped
expose:
- 3002
build:
context: ./wundergraph
environment:
SWITCHBOARD_GQL_ENDPOINT: "http://api:3000/graphql"
depends_on:
- api
# wundergraph:
# platform: linux/amd64
# restart: unless-stopped
# expose:
# - 3002
# build:
# context: ./wundergraph
# environment:
# SWITCHBOARD_GQL_ENDPOINT: "http://api:3000/graphql"
# depends_on:
# - api

reverse-proxy:
web:
restart: unless-stopped
image: nginx:stable
ports:
Expand All @@ -63,4 +63,4 @@ services:
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- api
- frontend
# - frontend
4 changes: 2 additions & 2 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WORKDIR /app/frontend
COPY frontend/package.json .
COPY frontend/package-lock.json .
COPY frontend/scripts ./scripts
RUN npm ci
RUN npm install

FROM dependency-base AS production-base

Expand All @@ -20,7 +20,7 @@ FROM dependency-base AS production-base
COPY frontend /app/frontend
COPY api /app/api
WORKDIR /app/api
RUN npm ci
RUN npm install
WORKDIR /app/frontend

# Set env vars before build
Expand Down
Loading

0 comments on commit d6fdd6e

Please sign in to comment.