Skip to content

Commit

Permalink
add docker, infra app and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed Aug 29, 2023
1 parent 67dd51d commit a946dda
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
branches:
- main
# ignore changes to infra/app/values.auto-updated.yaml (this file is updated by the CI workflow itself)
paths-ignore:
- infra/app/values.auto-updated.yaml
jobs:
ci:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_APP_IMAGE_NAME: "ghcr.io/whiletrue-industries/ckangpt-ui/ckangpt-ui"
run: |
echo "${GITHUB_TOKEN}" | docker login ghcr.io -u whiletrue-industries --password-stdin &&\
if docker pull "${DOCKER_APP_IMAGE_NAME}:latest"; then
CACHE_FROM_ARG="--cache-from ${DOCKER_APP_IMAGE_NAME}:latest"
else
CACHE_FROM_ARG=""
fi &&\
docker build $CACHE_FROM_ARG --build-arg VERSION=${GITHUB_SHA} -t app . &&\
docker tag app "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\
docker push "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
docker tag app "${DOCKER_APP_IMAGE_NAME}:latest" &&\
docker push "${DOCKER_APP_IMAGE_NAME}:latest" &&\
echo "ui:" > infra/app/values.auto-updated.yaml &&\
echo " image: ${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" >> infra/app/values.auto-updated.yaml &&\
# commit and push the updated values.auto-updated.yaml file
git config --global user.name "ckangpt-ui CI" &&\
git config --global user.email "ckangpt-ui-ci@localhost" &&\
git add infra/app/values.auto-updated.yaml &&\
git commit -m "automatic update of ckangpt-ui" &&\
git push origin main
fi
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Pulled Aug 29, 2023
FROM node:18@sha256:11e9c297fc51f6f65f7d0c7c8a8581e5721f2f16de43ceff1a199fd3ef609f95 as build
WORKDIR /srv
COPY package-lock.json package.json ./
RUN npm install
COPY angular.json tsconfig.json ./
COPY projects ./projects
RUN node_modules/.bin/ng build

# Pulled Aug 29, 2023
FROM nginx@sha256:104c7c5c54f2685f0f46f3be607ce60da7085da3eaa5ad22d3d9f01594295e9c
COPY --from=build /srv/dist/ckangpt /usr/share/nginx/html
Empty file.

0 comments on commit a946dda

Please sign in to comment.