diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..6aff804 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node +{ + "name": "Node.js & TypeScript", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "yarn install", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + "remoteUser": "root" +} diff --git a/.env.sample b/.env.sample index ea08bfa..451abee 100644 --- a/.env.sample +++ b/.env.sample @@ -25,4 +25,7 @@ PRICE_ID= NEXT_PUBLIC_TRIAL_PERIOD_DAYS= NEXT_PUBLIC_STRIPE_BILLING_PORTAL_URL= BASE_URL=http://localhost:3000 -NEXT_PUBLIC_PRICING= \ No newline at end of file +NEXT_PUBLIC_PRICING= + +# Docker postgres settings +POSTGRES_PASSWORD= diff --git a/.gitignore b/.gitignore index 3cec5f6..e10e251 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,6 @@ next-env.d.ts /test-results/ /playwright-report/ /playwright/.cache/ + +# docker +pgdata \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dd4e519 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# playwright doesnt support debian image +FROM ubuntu:focal + +run apt-get update && apt-get install wget xz-utils -y + +RUN mkdir /data + +WORKDIR /data + +RUN wget https://nodejs.org/dist/v20.5.0/node-v20.5.0-linux-x64.tar.xz -O nodejs.tar.xz \ + && mkdir /opt/nodejs \ + && tar -xf nodejs.tar.xz --strip-components 1 -C /opt/nodejs \ + && rm nodejs.tar.xz +ENV PATH="$PATH:/opt/nodejs/bin" +RUN npm install -g yarn + +COPY ./package.json ./yarn.lock ./playwright.config.ts . + +RUN yarn +RUN npx playwright install-deps + +COPY . . + +RUN yarn build + +CMD yarn prisma migrate deploy && yarn start + +# RUN apt-get update && apt-get install \ +# git \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4300c10 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3.5" +services: + linkwarden: + env_file: .env + restart: always + build: . + ports: + - 3000:3000 + volumes: + - /var/lib/elasticsearch/data + postgres: + image: postgres + env_file: .env + restart: always + volumes: + - ./pgdata:/var/lib/postgresql/data