Skip to content

Commit 0ecefac

Browse files
authored
Автодеплой фронта при мерже в master (#20)
* Dockerfile * ci: deploy frontend * chore: rm tsconfig.tsbuildinfo
1 parent 5bf2f0d commit 0ecefac

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

.github/workflows/exesh.deploy.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: FrontendDeploy
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
Deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Login to Docker Hub
12+
uses: docker/login-action@v3
13+
with:
14+
username: ${{ vars.DOCKERHUB_USERNAME }}
15+
password: ${{ secrets.DOCKERHUB_TOKEN }}
16+
- uses: actions/checkout@v3
17+
- name: Build and push
18+
uses: docker/build-push-action@v6
19+
with:
20+
push: true
21+
tags: docker.io/eewynell/coduels-frontend:latest

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:24-slim AS builder
2+
3+
RUN npm i -g pnpm
4+
5+
WORKDIR /app
6+
7+
COPY package.json pnpm-lock.yaml ./
8+
9+
RUN pnpm i
10+
11+
COPY src src
12+
COPY public public
13+
COPY *.ts *.js *.json *.yaml *.yml *.html ./
14+
15+
ARG VITE_BASE_URL=/api
16+
ENV VITE_BASE_URL=${VITE_BASE_URL}
17+
18+
RUN pnpm build
19+
20+
FROM nginx:alpine-slim
21+
22+
COPY ./nginx.conf /etc/nginx/nginx.conf
23+
24+
COPY --from=builder /app/dist/ /var/www
25+

nginx.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
http {
2+
server {
3+
include mime.types;
4+
listen 8080;
5+
root /var/www;
6+
try_files $uri $uri/ /index.html;
7+
}
8+
}
9+
10+
events {}
11+

vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import svgr from "vite-plugin-svgr";
44

55
// https://vite.dev/config/
66
export default defineConfig({
7+
build: {
8+
sourcemap: true,
9+
},
710
plugins: [react(), svgr()],
811
server: {
912
host: "127.0.0.1",

0 commit comments

Comments
 (0)