From c8673311ea87e5a205c448b46b0c7191e1d38d0c Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 27 Oct 2024 21:53:02 -0600 Subject: [PATCH] refactor: update dockerfile --- .github/CODEOWNERS | 2 + .github/FUNDING.yml | 13 ++++ .github/ISSUE_TEMPLATE/bug_report.yml | 62 ++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 5 ++ .github/ISSUE_TEMPLATE/feature-request.yml | 33 ++++++++++ .github/workflows/deploy.yml | 30 +++++++++ .github/workflows/pull-request.yml | 24 +++++++ Dockerfile.website | 34 ++++++++++ biome.json | 32 ++++++++-- package.json | 3 +- pnpm-lock.yaml | 74 +++++++++++----------- 11 files changed, 269 insertions(+), 43 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature-request.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/pull-request.yml create mode 100644 Dockerfile.website diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..2d3b039 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# These owners will be the default owners for everything in +* @siumauricio diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..e405a00 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: [siumauricio] +patreon: # +open_collective: dokploy +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..33bd328 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,62 @@ +name: Bug Report +description: Create a bug report +labels: ['bug'] +body: + - type: markdown + attributes: + value: | + Before opening a new issue, please do a search of existing issues. + + If you need help with your own project, you can start a discussion in the [Q&A Section](https://github.com/Dokploy/dokploy/discussions). + - type: textarea + attributes: + label: To Reproduce + description: A step-by-step description of how to reproduce the issue, or a link to the reproducible repository. + placeholder: | + 1. Create a application + 2. Click X + 3. Y will happen + validations: + required: true + - type: textarea + attributes: + label: Current vs. Expected behavior + description: A clear and concise description of what the bug is, and what you expected to happen. + placeholder: 'Following the steps from the previous section, I expected A to happen, but I observed B instead' + validations: + required: true + - type: textarea + attributes: + label: Provide environment information + description: Please provide the following information about your environment. + render: bash + placeholder: | + Operating System: + OS: Ubuntu 20.04 + Arch: arm64 + Dokploy version: 0.2.2' + VPS Provider: DigitalOcean, Hetzner, Linode, etc. + What applications/services are you tying to deploy? + eg - Database, Nextjs App, laravel, etc. + validations: + required: true + - type: dropdown + attributes: + label: Which area(s) are affected? (Select all that apply) + multiple: true + options: + - 'Installation' + - 'Application' + - 'Databases' + - 'Docker Compose' + - 'Traefik' + - 'Docker' + validations: + required: true + - type: textarea + attributes: + label: Additional context + description: | + Any extra information that might help us investigate. + placeholder: | + I tested on a DigitalOcean VPS with Ubuntu 20.04 and Docker version 20.10.12. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..da4c335 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Questions? + url: https://github.com/Dokploy/dokploy/discussions + about: Ask your questions here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..bfa9de8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,33 @@ +name: Feature Request +description: Suggest a new feature or improvement to the project +labels: ['enhancement'] +body: + - type: textarea + attributes: + label: What problem will this feature address? + description: A clear and concise description of what the problem is. + placeholder: | + I'm always frustrated when I can't do X + validations: + required: true + - type: textarea + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. + placeholder: Add X to the core + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + placeholder: | + Maybe use Y as a workaround? + validations: + required: true + - type: textarea + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. + validations: + required: false \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..3d556ab --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,30 @@ +name: Build Docker images + +on: + push: + branches: ["main"] + +jobs: + + build-and-push-image-website: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile.website + push: true + tags: dokploy/website:latest + platforms: linux/amd64 + diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..91b6378 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,24 @@ +name: Pull Request + +on: + pull_request: + branches: [main] + +env: + HUSKY: 0 + +jobs: + lint-and-typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.18.0 + cache: "pnpm" + - run: pnpm install --frozen-lockfile + - run: pnpm biome ci + - run: pnpm typecheck + + \ No newline at end of file diff --git a/Dockerfile.website b/Dockerfile.website new file mode 100644 index 0000000..da59b8c --- /dev/null +++ b/Dockerfile.website @@ -0,0 +1,34 @@ +FROM node:18-alpine AS base +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable + +FROM base AS build +COPY . /usr/src/app +WORKDIR /usr/src/app + + +# Install dependencies +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile + +# Deploy only the dokploy app + +ENV NODE_ENV=production +RUN pnpm run build + +RUN cp -R /usr/src/app/apps/website/.next .next + +FROM base AS dokploy +WORKDIR /app + +# Set production +ENV NODE_ENV=production + +# Copy only the necessary files +COPY --from=build /prod/website/.next ./.next +COPY --from=build /prod/website/public ./public +COPY --from=build /prod/website/package.json ./package.json +COPY --from=build /prod/website/node_modules ./node_modules + +EXPOSE 3000 +CMD HOSTNAME=0.0.0.0 && pnpm start \ No newline at end of file diff --git a/biome.json b/biome.json index 1e98f43..b6f6c41 100644 --- a/biome.json +++ b/biome.json @@ -1,14 +1,36 @@ { - "$schema": "https://biomejs.dev/schemas/1.7.0/schema.json", + "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", + "files": { + "ignore": ["node_modules/**", ".next/**", "drizzle/**", ".docker", "dist"] + }, "organizeImports": { "enabled": true }, "linter": { - "enabled": true, "rules": { - "recommended": true, - "a11y":{ - "noSvgWithoutTitle":"off" + "security": { + "noDangerouslySetInnerHtml": "off" + }, + "complexity": { + "noUselessCatch": "off", + "noBannedTypes": "off" + }, + "correctness": { + "useExhaustiveDependencies": "off", + "noUnsafeOptionalChaining": "off" + }, + "style": { + "noNonNullAssertion": "off" + }, + "suspicious": { + "noArrayIndexKey": "off", + "noExplicitAny": "off", + "noRedeclare": "off" + }, + "a11y": { + "noSvgWithoutTitle": "off", + "useKeyWithClickEvents": "off", + "useAriaPropsForRole": "off" } } } diff --git a/package.json b/package.json index 44cfe62..5b0b837 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "build": "next build", "start": "next start", "lint": "next lint", + "check": "biome check --write --no-errors-on-unmatched --files-ignore-unknown=true", "typecheck": "tsc --noEmit" }, "browserslist": "defaults, not ie <= 11", @@ -35,7 +36,7 @@ "@radix-ui/react-tabs": "1.1.1" }, "devDependencies": { - "@biomejs/biome": "1.7.0", + "@biomejs/biome": "1.8.3", "@types/react": "18.3.5", "@types/react-dom": "18.3.0", "prettier": "^3.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9c116ff..9c1a30d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -73,8 +73,8 @@ importers: version: 5.1.6 devDependencies: '@biomejs/biome': - specifier: 1.7.0 - version: 1.7.0 + specifier: 1.8.3 + version: 1.8.3 '@types/react': specifier: 18.3.5 version: 18.3.5 @@ -94,55 +94,55 @@ packages: resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} engines: {node: '>=10'} - '@biomejs/biome@1.7.0': - resolution: {integrity: sha512-mejiRhnAq6UrXtYvjWJUKdstcT58n0/FfKemFf3d2Ou0HxOdS88HQmWtQ/UgyZvOEPD572YbFTb6IheyROpqkw==} + '@biomejs/biome@1.8.3': + resolution: {integrity: sha512-/uUV3MV+vyAczO+vKrPdOW0Iaet7UnJMU4bNMinggGJTAnBPjCoLEYcyYtYHNnUNYlv4xZMH6hVIQCAozq8d5w==} engines: {node: '>=14.21.3'} hasBin: true - '@biomejs/cli-darwin-arm64@1.7.0': - resolution: {integrity: sha512-12TaeaKHU4SAZt0fQJ2bYk1jUb4foope7LmgDE5p3c0uMxd3mFkg1k7G721T+K6UHYULcSOQDsNNM8DhYi8Irg==} + '@biomejs/cli-darwin-arm64@1.8.3': + resolution: {integrity: sha512-9DYOjclFpKrH/m1Oz75SSExR8VKvNSSsLnVIqdnKexj6NwmiMlKk94Wa1kZEdv6MCOHGHgyyoV57Cw8WzL5n3A==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] - '@biomejs/cli-darwin-x64@1.7.0': - resolution: {integrity: sha512-6Qq1BSIB0cpp0cQNqO/+EiUV7FE3jMpF6w7+AgIBXp0oJxUWb2Ff0RDZdO9bfzkimXD58j0vGpNHMGnCcjDV2Q==} + '@biomejs/cli-darwin-x64@1.8.3': + resolution: {integrity: sha512-UeW44L/AtbmOF7KXLCoM+9PSgPo0IDcyEUfIoOXYeANaNXXf9mLUwV1GeF2OWjyic5zj6CnAJ9uzk2LT3v/wAw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] - '@biomejs/cli-linux-arm64-musl@1.7.0': - resolution: {integrity: sha512-pwIY80nU7SAxrVVZ6HD9ah1pruwh9ZqlSR0Nvbg4ZJqQa0POhiB+RJx7+/1Ml2mTZdrl8kb/YiwQpD16uwb5wg==} + '@biomejs/cli-linux-arm64-musl@1.8.3': + resolution: {integrity: sha512-9yjUfOFN7wrYsXt/T/gEWfvVxKlnh3yBpnScw98IF+oOeCYb5/b/+K7YNqKROV2i1DlMjg9g/EcN9wvj+NkMuQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - '@biomejs/cli-linux-arm64@1.7.0': - resolution: {integrity: sha512-GwSci7xBJ2j1CrdDXDUVXnUtrvypEz/xmiYPpFeVdlX5p95eXx+7FekPPbJfhGGw5WKSsKZ+V8AAlbN+kUwJWw==} + '@biomejs/cli-linux-arm64@1.8.3': + resolution: {integrity: sha512-fed2ji8s+I/m8upWpTJGanqiJ0rnlHOK3DdxsyVLZQ8ClY6qLuPc9uehCREBifRJLl/iJyQpHIRufLDeotsPtw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - '@biomejs/cli-linux-x64-musl@1.7.0': - resolution: {integrity: sha512-KzCA0mW4LSbCd7XZWaEJvTOTTBjfJoVEXkfq1fsXxww1HB+ww5PGMbhbIcbYCsj2CTJUifeD5hOkyuBVppU1xQ==} + '@biomejs/cli-linux-x64-musl@1.8.3': + resolution: {integrity: sha512-UHrGJX7PrKMKzPGoEsooKC9jXJMa28TUSMjcIlbDnIO4EAavCoVmNQaIuUSH0Ls2mpGMwUIf+aZJv657zfWWjA==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - '@biomejs/cli-linux-x64@1.7.0': - resolution: {integrity: sha512-1y+odKQsyHcw0JCGRuqhbx7Y6jxOVSh4lGIVDdJxW1b55yD22DY1kcMEfhUte6f95OIc2uqfkwtiI6xQAiZJdw==} + '@biomejs/cli-linux-x64@1.8.3': + resolution: {integrity: sha512-I8G2QmuE1teISyT8ie1HXsjFRz9L1m5n83U1O6m30Kw+kPMPSKjag6QGUn+sXT8V+XWIZxFFBoTDEDZW2KPDDw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - '@biomejs/cli-win32-arm64@1.7.0': - resolution: {integrity: sha512-AvLDUYZBpOUFgS/mni4VruIoVV3uSGbKSkZQBPXsHgL0w4KttLll3NBrVanmWxOHsom6C6ocHLyfAY8HUc8TXg==} + '@biomejs/cli-win32-arm64@1.8.3': + resolution: {integrity: sha512-J+Hu9WvrBevfy06eU1Na0lpc7uR9tibm9maHynLIoAjLZpQU3IW+OKHUtyL8p6/3pT2Ju5t5emReeIS2SAxhkQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] - '@biomejs/cli-win32-x64@1.7.0': - resolution: {integrity: sha512-Pylm00BAAuLVb40IH9PC17432BTsY8K4pSUvhvgR1eaalnMaD6ug9SYJTTzKDbT6r24MPAGCTiSZERyhGkGzFQ==} + '@biomejs/cli-win32-x64@1.8.3': + resolution: {integrity: sha512-/PJ59vA1pnQeKahemaQf4Nyj7IKUvGQSc3Ze1uIGi+Wvr1xF7rGobSrAAG01T/gUDG21vkDsZYM03NAmPiVkqg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] @@ -1295,39 +1295,39 @@ snapshots: '@alloc/quick-lru@5.2.0': {} - '@biomejs/biome@1.7.0': + '@biomejs/biome@1.8.3': optionalDependencies: - '@biomejs/cli-darwin-arm64': 1.7.0 - '@biomejs/cli-darwin-x64': 1.7.0 - '@biomejs/cli-linux-arm64': 1.7.0 - '@biomejs/cli-linux-arm64-musl': 1.7.0 - '@biomejs/cli-linux-x64': 1.7.0 - '@biomejs/cli-linux-x64-musl': 1.7.0 - '@biomejs/cli-win32-arm64': 1.7.0 - '@biomejs/cli-win32-x64': 1.7.0 + '@biomejs/cli-darwin-arm64': 1.8.3 + '@biomejs/cli-darwin-x64': 1.8.3 + '@biomejs/cli-linux-arm64': 1.8.3 + '@biomejs/cli-linux-arm64-musl': 1.8.3 + '@biomejs/cli-linux-x64': 1.8.3 + '@biomejs/cli-linux-x64-musl': 1.8.3 + '@biomejs/cli-win32-arm64': 1.8.3 + '@biomejs/cli-win32-x64': 1.8.3 - '@biomejs/cli-darwin-arm64@1.7.0': + '@biomejs/cli-darwin-arm64@1.8.3': optional: true - '@biomejs/cli-darwin-x64@1.7.0': + '@biomejs/cli-darwin-x64@1.8.3': optional: true - '@biomejs/cli-linux-arm64-musl@1.7.0': + '@biomejs/cli-linux-arm64-musl@1.8.3': optional: true - '@biomejs/cli-linux-arm64@1.7.0': + '@biomejs/cli-linux-arm64@1.8.3': optional: true - '@biomejs/cli-linux-x64-musl@1.7.0': + '@biomejs/cli-linux-x64-musl@1.8.3': optional: true - '@biomejs/cli-linux-x64@1.7.0': + '@biomejs/cli-linux-x64@1.8.3': optional: true - '@biomejs/cli-win32-arm64@1.7.0': + '@biomejs/cli-win32-arm64@1.8.3': optional: true - '@biomejs/cli-win32-x64@1.7.0': + '@biomejs/cli-win32-x64@1.8.3': optional: true '@floating-ui/core@1.6.8':