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

build: 패키지 매니저를 yarn으로 전환 #85

Merged
merged 8 commits into from
Jan 1, 2025
Merged
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: 5 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Test coverage for pull request

on:
pull_request:
branches:
- main
push:
branches:
- main
Expand All @@ -21,11 +18,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
25 changes: 10 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
name: Test for merged commit

on:
push:
pull_request:
paths-ignore:
- 'docs/**'
branches:
- main
pull_request:
branches:
- main

jobs:
build:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- 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 }}-
- name: Install dependencies
run: yarn install --immutable

- run: npm ci
- run: npm run test -- --maxWorkers=100%
- name: Run tests
run: yarn test --maxWorkers=100%
8 changes: 7 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,11 @@ test.sqlite3
!.vscode/launch.json
!.vscode/extensions.json

# yarn
.yarn

# 실수로 `npm install` 하는 경우를 방지하기 위함입니다.
# `yarn install`을 사용해주세요.
package-lock.json

.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
Loading