Skip to content

Commit

Permalink
Merge pull request #12 from PoolC/feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jinoov authored Sep 15, 2023
2 parents 38bd48d + 71cf8f8 commit 9424f8e
Show file tree
Hide file tree
Showing 11 changed files with 637 additions and 31 deletions.
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.env
.env.development
.env.production

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.idea

__generated__
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: deploy

on:
push:
branches: [master]

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

- name: setting env
run: |
# env file
$ENV_PRODUCTION=.env.production
echo "VITE_API_BASE_URL=$secrets.VITE_API_BASE_URL" > $ENV_PRODUCTION
echo "VITE_FILE_URL=$secrets.VITE_FILE_URL" > $ENV_PRODUCTION
echo "VITE_MAX_FILE_SIZE=$secrets.VITE_MAX_FILE_SIZE" > $ENV_PRODUCTION
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/my-container-test:latest
ghcr.io/${{ github.repository_owner }}/my-container-test:${{ env.RELEASE_VERSION }}
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
FROM nginx:1.19.8
FROM node:18-alpine

WORKDIR /var/www/poolc.org
COPY ./build .
COPY ./nginx.conf /etc/nginx/conf.d/poolc.org.conf
WORKDIR /app


COPY package.json yarn.lock ./
RUN yarn

COPY . .

RUN yarn codegen
CMD yarn build

VOLUME ["/app/build"]

CMD ["nginx", "-g", "daemon off;"]
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '1'
services:
app:
build:
dockerfile: Dockerfile
env_file: .env.production
environment:
- VITE_API_BASE_URL=$VITE_API_BASE_URL
- VITE_FILE_URL=$VITE_FILE_URL
- VITE_MAX_FILE_SIZE=$VITE_MAX_FILE_SIZE
stdin_open: true
volumes:
- app-assets:/app/build

web:
build:
dockerfile: nginx.Dockerfile
ports:
- "80:80"
volumes:
- web-logs:/var/log/nginx
- app-assets:/var/www

volumes:
web-logs:
app-assets:
5 changes: 5 additions & 0 deletions nginx.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nginx:alpine

COPY nginx.conf /etc/nginx/conf.d/default.conf

VOLUME ["/var/log/nginx", "/var/www"]
28 changes: 15 additions & 13 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 500;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;

server {
root /var/www/poolc.org;
index index.html;
listen 80 default_server;
listen [::]:80 default_server;

sendfile on;
tcp_nopush on;
tcp_nodelay on;

gzip on;
gzip_vary on;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

location / {
try_files $uri /index.html;
root /var/www;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

listen 8080 default_server;
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"start": "vite",
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"sync:type": "npx typesync",
"check:type": "tsc --noEmit",
"codegen": "openapi -i http://server.poolc.kr:8080/v2/api-docs -o src/lib/api-v2/__generated__ -c axios --useUnionTypes --useOptions",
Expand Down
5 changes: 4 additions & 1 deletion src/components/admin/AdminBadge/AdminBadgeManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ export default function AdminBadgeManagement() {
{showEditModal && (
<BadgeEditModal
onCancel={() => setShowEditModal(false)}
onOk={onRefecthAllBadges}
onOk={() => {
setShowEditModal(false);
onRefecthAllBadges().catch(console.log);
}}
initialValues={dataSource.find((data) => data.id === editId)!}
/>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/my-page/MyPageBadgeListPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Avatar, Image, Progress, Space, Tooltip, Typography } from 'antd';
import { Avatar, Progress, Space, Tooltip, Typography } from 'antd';
import { createStyles } from 'antd-style';
import { match } from 'ts-pattern';
import {
Expand Down Expand Up @@ -210,7 +210,7 @@ export default function MyPageBadgeListPage() {
<div className={styles.badgeWrap}>
{baekjoonTierBadges.map((badge) => (
<Tooltip key={badge.id} title={renderBadgeTooltipTitle(badge)}>
<Image src={badge.imageUrl} alt={badge.name} />
<Avatar src={badge.imageUrl} alt={badge.name} />
</Tooltip>
))}
</div>
Expand Down
3 changes: 0 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ export default defineConfig(({ mode }) => {
},
build: {
outDir: 'build',
rollupOptions: {
external: ['react', 'react/jsx-runtime', 'react-dom'],
},
},
plugins: [react()],
define: {
Expand Down
Loading

0 comments on commit 9424f8e

Please sign in to comment.