diff --git a/.github/workflows/exesh.deploy.yml b/.github/workflows/exesh.deploy.yml new file mode 100644 index 0000000..65b5ee9 --- /dev/null +++ b/.github/workflows/exesh.deploy.yml @@ -0,0 +1,21 @@ +name: FrontendDeploy +on: + push: + branches: + - master + +jobs: + Deploy: + runs-on: ubuntu-latest + steps: + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - uses: actions/checkout@v3 + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: docker.io/eewynell/coduels-frontend:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4d64b11 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM node:24-slim AS builder + +RUN npm i -g pnpm + +WORKDIR /app + +COPY package.json pnpm-lock.yaml ./ + +RUN pnpm i + +COPY src src +COPY public public +COPY *.ts *.js *.json *.yaml *.yml *.html ./ + +ARG VITE_BASE_URL=/api +ENV VITE_BASE_URL=${VITE_BASE_URL} + +RUN pnpm build + +FROM nginx:alpine-slim + +COPY ./nginx.conf /etc/nginx/nginx.conf + +COPY --from=builder /app/dist/ /var/www + diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..dfe10ba --- /dev/null +++ b/nginx.conf @@ -0,0 +1,11 @@ +http { + server { + include mime.types; + listen 8080; + root /var/www; + try_files $uri $uri/ /index.html; + } +} + +events {} + diff --git a/vite.config.ts b/vite.config.ts index 6a7259a..2529c3d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,9 @@ import svgr from "vite-plugin-svgr"; // https://vite.dev/config/ export default defineConfig({ + build: { + sourcemap: true, + }, plugins: [react(), svgr()], server: { host: "127.0.0.1",