Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
artur rocks committed Oct 21, 2024
1 parent 968eafb commit 0399336
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 26 deletions.
63 changes: 45 additions & 18 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Docker Image CI
on:
push:
branches: [main, dev, release/*]
tags:
- 'v*'
pull_request:
branches: [main]

Expand All @@ -29,13 +31,26 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Extract Git metadata
id: vars
run: |
echo "GIT_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build and push FITSInn REST
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: artourkin/fitsinn-rest:${{ github.ref_name }}
run: |
IMAGE_NAME=artourkin/fitsinn-rest
CONTEXT=.
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
docker buildx build --push --tag $IMAGE_NAME:latest $CONTEXT
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
docker buildx build --push --tag $IMAGE_NAME:${{ steps.vars.outputs.GIT_TAG }} $CONTEXT
else
docker buildx build --push --tag $IMAGE_NAME:${{ steps.vars.outputs.BRANCH_NAME }}-${{ steps.vars.outputs.GIT_SHA_SHORT }} $CONTEXT
fi
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
Expand All @@ -53,17 +68,29 @@ jobs:
name: List the state of node modules
continue-on-error: true
run: npm list

- name: Build and push FITSInn WEB
uses: docker/build-push-action@v5
with:
file: ./web/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: artourkin/fitsinn-web:${{ github.ref_name }}
run: |
IMAGE_NAME=artourkin/fitsinn-web
CONTEXT=./web
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
docker buildx build --push --tag $IMAGE_NAME:latest $CONTEXT
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
docker buildx build --push --tag $IMAGE_NAME:${{ steps.vars.outputs.GIT_TAG }} $CONTEXT
else
docker buildx build --push --tag $IMAGE_NAME:${{ steps.vars.outputs.BRANCH_NAME }}-${{ steps.vars.outputs.GIT_SHA_SHORT }} $CONTEXT
fi
- name: Build and push FITS WEB
uses: docker/build-push-action@v5
with:
file: ./fits/Dockerfile
platforms: linux/amd64,linux/arm64/v8
push: true
tags: artourkin/fits-web:${{ github.ref_name }}
run: |
IMAGE_NAME=artourkin/fits-web
CONTEXT=./fits
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
docker buildx build --push --tag $IMAGE_NAME:latest $CONTEXT
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
docker buildx build --push --tag $IMAGE_NAME:${{ steps.vars.outputs.GIT_TAG }} $CONTEXT
else
docker buildx build --push --tag $IMAGE_NAME:${{ steps.vars.outputs.BRANCH_NAME }}-${{ steps.vars.outputs.GIT_SHA_SHORT }} $CONTEXT
fi

8 changes: 4 additions & 4 deletions docker-compose.clickhouse.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ services:

fits:
build:
context: .
dockerfile: ./fits/Dockerfile
context: ./fits
dockerfile: ./Dockerfile
container_name: fits
env_file: .env
networks:
Expand Down Expand Up @@ -34,8 +34,8 @@ services:

web:
build:
context: .
dockerfile: ./web/Dockerfile
context: ./web
dockerfile: ./Dockerfile
container_name: web
env_file: .env
networks:
Expand Down
8 changes: 4 additions & 4 deletions web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ FROM node:14.5.0-stretch-slim as build
WORKDIR /app

ENV PATH /app/node_modules/.bin:$PATH
COPY ./web/frontend/package.json ./
COPY ./web/frontend/package-lock.json ./
COPY ./frontend/package.json ./
COPY ./frontend/package-lock.json ./

RUN npm ci
RUN npm install [email protected] -g

COPY ./web/frontend ./
COPY ./frontend ./
RUN npm run build


FROM nginx:stable-alpine-slim
COPY --from=build /app/build /usr/share/nginx/html
COPY ./web/nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 0399336

Please sign in to comment.