-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOP-21434] create docker image and docker ci (#43)
Co-authored-by: Zabilsya <[email protected]>
- Loading branch information
Showing
12 changed files
with
197 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.git/ | ||
.github/ | ||
.dockerignore | ||
.gitignore | ||
./docker/Dockerfile | ||
*docker-compose* | ||
|
||
.husky/ | ||
node_modules/ | ||
public/env-config.js | ||
env-config.js | ||
dist/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Code analysis | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches-ignore: | ||
- master | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
linters: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install modules | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Cache modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./node_modules | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
${{ runner.os }}-yarn- | ||
- name: Run Type check | ||
run: yarn type-check | ||
|
||
- name: Run ESLint | ||
run: yarn lint | ||
|
||
- name: Run Prettier | ||
run: yarn prettier --check | ||
|
||
- name: Build project | ||
run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
release: | ||
name: Build & push frontend image to Dockerhub | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'MobileTeleSystems/syncmaster-ui' # prevent running on forks | ||
|
||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set tag | ||
id: set_tag | ||
run: | | ||
if [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref_name }}" == "develop" ]]; then | ||
echo "TAG=mtsrus/syncmaster-ui:develop" >> $GITHUB_ENV | ||
elif [[ "${{ github.ref_type }}" == "tag" ]]; then | ||
echo "TAG=mtsrus/syncmaster-ui:latest,mtsrus/syncmaster-ui:${{ github.ref_name }}" >> $GITHUB_ENV | ||
fi | ||
- name: Build UI image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
tags: ${{ env.TAG }} | ||
context: . | ||
file: ./docker/Dockerfile | ||
target: prod | ||
pull: true | ||
push: true | ||
cache-to: type=inline | ||
cache-from: mtsrus/syncmaster-ui:develop | ||
platforms: | | ||
linux/amd64 | ||
linux/arm64/v8 | ||
provenance: mode=max | ||
|
||
- name: Update DockerHub Description | ||
uses: peter-evans/dockerhub-description@v4 | ||
if: github.ref_type == 'tag' | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
# this requires token with read+write+delete permissions. read+write is not enough! | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
repository: mtsrus/syncmaster-ui | ||
short-description: ${{ github.event.repository.description }} | ||
enable-url-completion: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,7 @@ yarn-error.log | |
|
||
|
||
/**/generated | ||
/**/build | ||
/**/build | ||
|
||
public/env-config.js | ||
env-config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM node:23.1.0 AS build | ||
|
||
WORKDIR /app | ||
|
||
COPY .yarnrc.yml . | ||
COPY .yarn ./.yarn | ||
|
||
COPY package.json yarn.lock ./ | ||
RUN yarn install --immutable | ||
|
||
COPY . . | ||
RUN yarn build | ||
|
||
|
||
FROM nginx:stable AS prod | ||
|
||
WORKDIR /usr/share/nginx/html | ||
|
||
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf | ||
COPY --from=build /app/dist . | ||
|
||
COPY ./docker/entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
EXPOSE 3000 | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
cat <<EOF > /usr/share/nginx/html/env-config.js | ||
window.env = { | ||
API_URL: "${API_URL}", | ||
}; | ||
EOF | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
server { | ||
listen 3000; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
|
||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
declare module '*.less' { | ||
const content: Record<string, string>; | ||
export default content; | ||
} | ||
|
||
interface Window { | ||
env?: { | ||
API_URL: string; | ||
}; | ||
} |