Skip to content

Commit

Permalink
build: 패키지 매니저를 yarn으로 전환
Browse files Browse the repository at this point in the history
  • Loading branch information
Coalery committed Jan 1, 2025
1 parent 7059b53 commit aa6c6e9
Show file tree
Hide file tree
Showing 10 changed files with 9,201 additions and 11,737 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ jobs:
with:
node-version-file: '.nvmrc'

- name: Prepare yarn
run: corepack enable && corepack prepare [email protected] --activate

- name: Install dependencies
run: npm ci
run: yarn install --immutable

- name: Run tests
run: npm run test:cov -- --maxWorkers=100%
run: yarn test:cov --maxWorkers=100%

- name: Coverage
uses: coverallsapp/[email protected]
Expand Down
29 changes: 21 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,28 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Prepare yarn
run: corepack enable && corepack prepare [email protected] --activate

- name: Get yarn version
id: yarn-version
run: echo "YARN_VERSION=$(yarn -v)" >> $GITHUB_OUTPUT

- name: Get cache dir path
id: yarn-cache-dir-path
run: echo "CACHE_DIR=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- run: npm ci
- run: npm run test -- --maxWorkers=100%
path: ${{ steps.yarn-cache-dir-path.outputs.CACHE_DIR }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ steps.yarn-version.outputs.YARN_VERSION }}
restore-keys: ${{ runner.OS }}-yarn-${{ hashFiles('**/yarn.lock') }}-

- name: Install dependencies
run: yarn install --immutable

- name: Run tests
run: yarn test:cov --maxWorkers=100%
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ lerna-debug.log*

# Tests
/coverage
/.nyc_output
test.sqlite3

# IDEs and editors
Expand All @@ -35,4 +34,7 @@ test.sqlite3
!.vscode/launch.json
!.vscode/extensions.json

# yarn
.yarn

.env.production
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
14 changes: 8 additions & 6 deletions Dockerfile.Build
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@ FROM node:20-alpine as builder
ENV NODE_ENV build
WORKDIR /sight

COPY ./ /sight
COPY . .

RUN npm ci
RUN npm run build \
&& npm prune --production
RUN corepack enable && corepack prepare [email protected] --activate
RUN yarn install --immutable
RUN yarn build

FROM node:20-alpine

ENV NODE_ENV production
WORKDIR /sight

COPY --from=builder /sight/package*.json ./
RUN corepack enable && corepack prepare [email protected] --activate

COPY --from=builder /sight/package.json /sight/yarn.lock ./
COPY --from=builder /sight/.env.* ./
COPY --from=builder /sight/node_modules/ ./node_modules/
COPY --from=builder /sight/dist/ ./dist/

EXPOSE 3000
CMD ["npm", "run", "start:prod"]
CMD ["yarn", "start:prod"]
8 changes: 5 additions & 3 deletions Dockerfile.Local
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ FROM node:20-alpine

WORKDIR /sight

COPY package*.json ./
RUN npm ci
RUN corepack enable && corepack prepare [email protected] --activate
COPY package.json yarn.lock .yarnrc.yml ./

RUN yarn install

EXPOSE 3000
CMD ["npm", "run", "start:dev"]
CMD ["yarn", "start:dev"]
8 changes: 6 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ services:
volumes:
- ./.mysql/:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-hlocalhost", "-ptest"]
interval: 5s
test: [
"CMD-SHELL",
"mysql -uroot -ptest -e 'SELECT 1;' || exit 1"
]
interval: 1s
timeout: 1s
retries: 20
start_period: 5s
Expand All @@ -24,6 +27,7 @@ services:
build:
context: .
dockerfile: Dockerfile.Local
container_name: sight-backend
restart: always
ports:
- 3000:3000
Expand Down
Loading

0 comments on commit aa6c6e9

Please sign in to comment.