-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Migrate CI to skaffold * Remove test branch from ci * Remove 'Install werf' stage from CI
- Loading branch information
Showing
5 changed files
with
55 additions
and
79 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 |
---|---|---|
|
@@ -14,24 +14,29 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install werf | ||
uses: werf/actions/[email protected] | ||
|
||
- name: Log in to registry | ||
# This is where you will update the personal access token to GITHUB_TOKEN | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
|
||
- name: Run echo | ||
run: | | ||
werf version | ||
docker version | ||
echo $GITHUB_REPOSITORY | ||
echo $GITHUB_SHA | ||
- name: Run Build | ||
- name: Cache layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: "${{ github.workspace }}/.skaffold/cache" | ||
key: skaffold-${{ hashFiles('**/cache') }} | ||
restore-keys: | | ||
skaffold- | ||
- name: Set up environment variables | ||
run: | | ||
. $(werf ci-env github --as-file) | ||
echo "${{ secrets.STAGE_ENV }}" > .env.deploy | ||
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA --dev | ||
- name: Run Skaffold pipeline as command | ||
uses: hiberbee/[email protected] | ||
id: build | ||
with: | ||
command: build --tag ${{ github.sha }} | ||
repository: ghcr.io/${{ github.repository_owner }} | ||
|
||
stage-deploy: | ||
name: Deploy on stage | ||
needs: converge | ||
|
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 |
---|---|---|
|
@@ -14,24 +14,29 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install werf | ||
uses: werf/actions/[email protected] | ||
|
||
- name: Log in to registry | ||
# This is where you will update the personal access token to GITHUB_TOKEN | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
|
||
- name: Run echo | ||
run: | | ||
werf version | ||
docker version | ||
echo $GITHUB_REPOSITORY | ||
echo $GITHUB_REF_NAME | ||
- name: Run Build | ||
- name: Cache layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: "${{ github.workspace }}/.skaffold/cache" | ||
key: skaffold-${{ hashFiles('**/cache') }} | ||
restore-keys: | | ||
skaffold- | ||
- name: Set up environment variables | ||
run: | | ||
. $(werf ci-env github --as-file) | ||
echo "${{ secrets.PROD_ENV }}" > .env.deploy | ||
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME --dev | ||
- name: Run Skaffold pipeline as command | ||
uses: hiberbee/[email protected] | ||
id: build | ||
with: | ||
command: build --tag ${{ github.ref_name }} | ||
repository: ghcr.io/${{ github.repository_owner }} | ||
|
||
prod-deploy: | ||
name: Deploy on prod | ||
needs: converge | ||
|
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,22 +1,19 @@ | ||
FROM node:14-alpine3.11 as builder | ||
RUN apk --no-cache --update --virtual build-dependencies add \ | ||
python \ | ||
make \ | ||
g++ | ||
|
||
ARG BUILD_VERSION | ||
WORKDIR /dist | ||
COPY package*.json ./ | ||
COPY yarn*.lock ./ | ||
RUN true \ | ||
&& yarn autoclean --init \ | ||
&& yarn autoclean --force \ | ||
&& yarn install \ | ||
&& true | ||
FROM node:18-alpine AS builder | ||
|
||
RUN apk --no-cache --update --virtual build-dependencies add python3 make g++ | ||
|
||
WORKDIR /frontend | ||
|
||
COPY package.json yarn.lock ./ | ||
|
||
RUN yarn install | ||
|
||
COPY . . | ||
RUN yarn lint | tee 1.log | sed -e 's/^/[yarn lint] /' & yarn test | tee 2.log | sed -e 's/^/[yarn test] /' & yarn build --set-build-version "$BUILD_VERSION" | tee 3.log | sed -e 's/^/[yarn build] /' | ||
|
||
FROM nginx:1.20.2-alpine | ||
RUN yarn generate --dotenv .env.deploy | ||
|
||
FROM nginx:alpine | ||
|
||
COPY nginx.conf /etc/nginx/nginx.conf | ||
COPY --from=builder /build/dist /usr/share/nginx/html | ||
CMD ["nginx", "-g", "daemon off;"] | ||
|
||
COPY --from=builder /frontend/.output/public /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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: skaffold/v2beta28 | ||
kind: Config | ||
build: | ||
artifacts: | ||
- image: frontend |