-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from tautf/docker-compatibility
Docker compatibility
- Loading branch information
Showing
10 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Dockerfile | ||
.dockerignore | ||
npm-debug.log | ||
README.md | ||
.next | ||
.git | ||
.github | ||
.husky | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: publish | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
docker build . --tag ghcr.io/tautf/foinix:latest | ||
docker push ghcr.io/tautf/foinix:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM node:20-alpine AS base | ||
|
||
FROM base AS deps | ||
RUN apk add --no-cache libc6-compat | ||
WORKDIR /app | ||
|
||
COPY prisma ./prisma/ | ||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ | ||
RUN \ | ||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ | ||
elif [ -f package-lock.json ]; then npm ci; \ | ||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
|
||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
RUN yarn global add prisma | ||
RUN prisma generate | ||
RUN yarn build | ||
|
||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV production | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
COPY --from=builder /app/public ./public | ||
|
||
RUN mkdir .next | ||
RUN chown nextjs:nodejs .next | ||
|
||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma | ||
|
||
USER nextjs | ||
|
||
EXPOSE 3000 | ||
|
||
ENV PORT 3000 | ||
ENV HOSTNAME "0.0.0.0" | ||
|
||
CMD ["yarn", "start:migrate:prod"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- AlterTable | ||
ALTER TABLE "Product" ADD COLUMN "cmdb_link" TEXT; | ||
|
||
INSERT INTO "ProductType" ("name",description,"createdAt","updatedAt",icon) VALUES | ||
('Other',NULL,'2023-11-29 15:17:00.000','2023-11-29 15:17:00.000','WrenchIcon'), | ||
('Computer','A desktop computer','2023-11-29 15:17:00.000','2023-11-29 15:17:00.000','DesktopComputerIcon'), | ||
('Software','Software','2023-11-29 15:17:00.000','2023-11-29 15:17:00.000','CommandLineIcon'), | ||
('Server','A server','2023-11-29 15:17:00.000','2023-11-29 15:17:00.000','ServerIcon'), | ||
('Subscription','A subscription','2023-11-29 15:17:00.000','2023-11-29 15:17:00.000','ArrowPathIcon'), | ||
('Mobile Device','Mobile device like Laptops','2023-11-29 15:17:00.000','2023-11-29 15:17:00.000','DevicePhoneMobileIcon'), | ||
('Network Device','Network devices like switches','2023-11-29 15:17:00.000','2023-11-29 15:17:00.000','CpuChipIcon'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
datasource db { | ||
url = env("DATABASE_URL") | ||
directUrl= env("DATABASE_DIRECT_URL") | ||
provider = "postgresql" | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import { PrismaClient } from '@prisma/client'; | ||
|
||
const prisma = new PrismaClient(); | ||
const prisma = new PrismaClient({ | ||
datasources: { | ||
db: { | ||
url: process.env.DATABASE_URL, | ||
}, | ||
|
||
}, | ||
}); | ||
|
||
export default prisma; |