Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: test turbo cache sharing with docker and gha #67

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.next
.expo
.turbo
.git
node_modules/**

# Compiled JavaScript
packages/**/build

!node_modules/.cache
30 changes: 30 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: docker

on:
workflow_dispatch:
push:
branches: [main]
pull_request:
types: [opened, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true

jobs:
packages:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: 🏗 Setup repository
uses: actions/checkout@v3

- name: 🏗 Setup monorepo
uses: ./.github/actions/setup-monorepo

- name: 👷 Build packages
run: pnpm run -w build

- name: 👷 Build image
run: docker build . -t acme/web -f ./apps/web/Dockerfile
23 changes: 23 additions & 0 deletions apps/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Setup node + pnpm
FROM node:16-alpine as base
WORKDIR /project
RUN corepack enable && corepack prepare pnpm@latest --activate

# Setup monorepo for development
FROM base as development
COPY . ./
COPY ./node_modules/.cache ./node_modules/.cache
RUN pnpm install --frozen-lockfile && pnpm build --filter "{./apps/web}..."

# Setup monorepo for production
FROM base as production
COPY --from=development /project ./
RUN pnpx rimraf ./**/node_modules ./apps/[!web]* \
&& pnpm install --prod \
&& rm -rf $(pnpm store path) \
&& rm -rf ./apps/web/.next/cache

# Start the server
WORKDIR /project/apps/web
EXPOSE 3000
CMD ["pnpm", "start"]
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"lint": "eslint --ext js,ts,tsx ."
},
"dependencies": {
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
"eslint": "7.32.0",
Expand Down
Loading