Skip to content

Commit

Permalink
build: fix deps
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlking committed Feb 24, 2024
1 parent 2f76956 commit 5514fcc
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
!/packages
!/patches
!/config
!/scripts
!.env.example
!.secrets.example

**/build
**/.turbo
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,15 @@ pids
!.env.test.example
!.env.project
!.env.vault

.secrets
.secrets.*
.secrets.local
.secrets.*.local
!.secrets.example
!.secrets.local.example
!.secrets.production.example
!.secrets.test.example

# nhost #
##########################
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
".eslintrc.cjs": ".eslint*,.markuplintrc.cjs,.markdownlintignore,.lintstagedrc.cjs,.editorconfig,.textlintignore",
".prettierrc.cjs": ".prettier*",
".env": ".env*,.secrets*",
".gitignore": ".gitattributes,.vercelignore,.dockerignore",
".gitignore": ".gitattributes,.vercelignore",
"README.md": "DEVELOPERS.md,CHANGELOG.md,CODE_OF_CONDUCT.md,CONTRIBUTING.md,LICENSE",
"Dockerfile": "*.Dockerfile,Dockerfile.*,compose*.yml",
"Dockerfile": "*.Dockerfile,Dockerfile.*,compose*.yml,.dockerignore",
"vitest.config.ts": "vitest.*",
"package.json": "pnpm-lock.yaml,pnpm-workspace.yaml",
"tailwind.config.*": "postcss.config*",
Expand Down
40 changes: 26 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,42 @@ RUN turbo prune --scope=${SCOPE} --docker
FROM base AS builder

WORKDIR /app
# First install the dependencies (as they change less often)
## First install the dependencies (as they change less often)
COPY .gitignore .gitignore

## scripts/init.sh will copy .env, .secrets needed during build
COPY scripts scripts
COPY .env.example .env.example
COPY .secrets.example .secrets.example
COPY apps/console/.env.example apps/console/.env.example
COPY apps/console/.secrets.example apps/console/.secrets.example
COPY apps/console-fb/.env.example apps/console-fb/.env.example
COPY apps/console-fb/.secrets.example apps/console-fb/.secrets.example

COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml

# https://playwright.dev/docs/browsers
## https://playwright.dev/docs/browsers
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD 1

# RUN pnpm install --frozen-lockfile FIXME: https://github.com/vercel/turbo/pull/7512
RUN pnpm install --no-frozen-lockfile --ignore-scripts
## FIXME: https://github.com/vercel/turbo/pull/7512
# RUN pnpm install --frozen-lockfile
RUN pnpm install --no-frozen-lockfile
# RUN pnpm install --no-frozen-lockfile --ignore-scripts

# Build the project
## Build the project
COPY --from=pruner /app/out/full/ .
COPY --from=pruner /app/.git .git
COPY turbo.json turbo.json

# Uncomment and use build args to enable remote caching
## Uncomment and use build args to enable remote caching
ARG TURBO_TEAM
ENV TURBO_TEAM=$TURBO_TEAM

ARG TURBO_TOKEN
ENV TURBO_TOKEN=$TURBO_TOKEN

# TODO: set any extra ENV needed for build
## TODO: set any extra ENV needed for build
# ENV ENCRYPTION_SECRET=encryption_secret_placeholder123 NEXTAUTH_URL=http://localhost:3000 NEXT_PUBLIC_VIEWER_URL=http://localhost:3001
RUN pnpm turbo run build --filter=${SCOPE}...

Expand All @@ -76,34 +88,34 @@ WORKDIR /app
ENV NODE_ENV production
ARG SCOPE

# copy tini
## copy tini
COPY --from=builder --chown=node:node /usr/bin/tini /usr/bin/tini
ENTRYPOINT ["/usr/bin/tini", "-s", "--", "/usr/bin/node"]

# copy runtime needed config files???
## copy runtime needed config files???
COPY --from=builder --chown=node:node /app/apps/${SCOPE}/package.json .
# COPY --from=builder --chown=node:node /app/config ./config

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
## Automatically leverage output traces to reduce image size
## https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=node:node /app/apps/${SCOPE}/build ./build


EXPOSE 3000
ENV PORT 3000

# Metadata params
## Metadata params
ARG DOCKER_REGISTRY=ghcr.io
ARG VCS_CONTEXT_PATH=xmlking/spectacular
ARG BUILD_TIME
ARG BUILD_VERSION
ARG VCS_REF=1
ARG VENDOR=xmlking

# for faster docker shutdown
## for faster docker shutdown
STOPSIGNAL SIGINT

# Metadata
## Metadata
LABEL org.opencontainers.image.created=$BUILD_TIME \
org.opencontainers.image.name="${SCOPE}" \
org.opencontainers.image.title="${SCOPE}" \
Expand Down

0 comments on commit 5514fcc

Please sign in to comment.