Skip to content

Commit

Permalink
build(next): add build info as public resource (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
tthvo authored and connordoman committed Jan 28, 2024
1 parent 02fdc49 commit c7f687a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
1 change: 0 additions & 1 deletion app/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ RUN mkdir .next && chown nextjs .next
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs /app/.next/standalone ./
COPY --from=builder --chown=nextjs /app/.next/static ./.next/static
# COPY --from=builder /app/public ./public

USER nextjs

Expand Down
4 changes: 4 additions & 0 deletions app/web/public/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": "0.1.0-dev",
"productName": "privacypal"
}
12 changes: 7 additions & 5 deletions app/web/src/app/health/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PRIVACYPAL_VERSION } from "@lib/config";
import prisma from "@lib/db";
import build from "@public/build.json";
import db from "@lib/db";
import { JSONResponse } from "@lib/response";
import { client, testS3Connection } from "@lib/s3";
import { testS3Connection } from "@lib/s3";

export const dynamic = "force-dynamic";

/* Video processing */

Expand All @@ -38,7 +40,7 @@ async function checkVideoProcessor(): Promise<boolean> {

async function checkPostgres(): Promise<boolean> {
try {
await prisma.$connect();
await db.$connect();
return true;
} catch (err: any) {
return false;
Expand All @@ -60,7 +62,7 @@ export async function GET() {

const response: JSONResponse = {
data: {
app_version: PRIVACYPAL_VERSION,
app_version: build.version,
video_processor_available: videoProcessorAlive,
database_available: databaseAlive,
video_storage_available: s3Alive,
Expand Down
3 changes: 2 additions & 1 deletion app/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"@patternfly/assets/*": [
"node_modules/@patternfly/react-core/dist/styles/assets/*"
],
"@conf/*": ["./conf/*"]
"@conf/*": ["./conf/*"],
"@public/*": ["./public/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
Expand Down

0 comments on commit c7f687a

Please sign in to comment.