Skip to content

Commit

Permalink
Add UI deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
ozonophore committed Nov 8, 2023
1 parent c402221 commit 7750272
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ jobs:
- name: Build and push app
uses: docker/build-push-action@v4
with:
context: ./web
file: ./web/Dockerfile
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.actor }}/yoda-web:latest,ghcr.io/${{ github.actor }}/yoda-web:${{ steps.get-version.outputs.substring }}
release:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ build
coverage.html
**/.docker-conf/**
.*
.data
.data

**/node_modules/**
44 changes: 41 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
FROM node
FROM node as build-ui

WORKDIR /app

RUN npm i tar
RUN npm install -g create-react-app
RUN npm install -g openapi

COPY website /app
COPY website/src /app/src
COPY website/package.json /app
COPY website/package-lock.json /app
COPY website/public /app/public
COPY website/tsconfig.json /app

ENTRYPOINT ["bash"]
COPY web/openapi/openapi.yml /app/openapi.yml
RUN npm run build

## Build
FROM golang:1.20 AS build-backend

WORKDIR /app

COPY web/cmd ./cmd
COPY web/internal ./internal
COPY web/openapi ./openapi
COPY web/go.mod ./go.mod
COPY web/go.sum ./go.sum
COPY web/Makefile ./Makefile

RUN go mod download

RUN make build

## Deploy
FROM centos:7

WORKDIR /app

COPY web/openapi /app/openapi
COPY --from=build-ui /app/build /app/public

VOLUME /tmp

EXPOSE 8080

COPY --from=build-backend /app/build/web-amd64-linux /app/web-amd64-linux

ENTRYPOINT ["/app/web-amd64-linux"]
10 changes: 5 additions & 5 deletions website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"react-dom": "18.2.0",
"react-highlight-words": "^0.20.0",
"react-router-dom": "^6.15.0",
"typescript": "5.1.6"
"typescript": "4.9.5"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
Expand All @@ -31,7 +31,7 @@
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"generate": "openapi --input ./openapi.yml --output ./src/client --client fetch",
"clean": "rm -rf ./build ./node_modules"
"clean": "rm -rf ./build/* ./node_modules"
},
"name": "f8q3qh",
"version": "0.0.0",
Expand Down

0 comments on commit 7750272

Please sign in to comment.