Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The template no longer use the node image in production #213

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 7 additions & 30 deletions .github/workflows/publish-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ env:
IMAGE_REGISTRY: ghcr.io
REGISTRY_USER: $GITHUB_ACTOR
API_IMAGE: ghcr.io/equinor/template-fastapi-react/api
WEB_IMAGE: ghcr.io/equinor/template-fastapi-react/web
NGINX_IMAGE: ghcr.io/equinor/template-fastapi-react/nginx

jobs:
build-and-publish-web-main:
build-and-publish-nginx-main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
Expand All @@ -37,16 +36,17 @@ jobs:

- name: "Build web"
run: |
docker pull $WEB_IMAGE
docker pull $NGINX_IMAGE
printf "$(git log -n 1 --format=format:'hash: %h%ndate: %cs%nrefs: %d' --decorate=short --decorate-refs=refs/tags | sed 's/ (tag: \([^\s]*\))/\1/')" > ./web/public/version.txt
docker build \
--build-arg REDIRECT_URI=${{inputs.oauth-redirect-url}} \
--build-arg AUTH_ENABLED=1 \
--build-arg AUTH_SCOPE=api://4a761bec-628d-4c4b-860a-4903cbecc963/api \
--build-arg CLIENT_ID=4a761bec-628d-4c4b-860a-4903cbecc963 \
--build-arg TENANT_ID=3aa4a235-b6e2-48d5-9195-7fcf05b459b0 \
--cache-from ${WEB_IMAGE} \
--tag ${WEB_IMAGE} \
--cache-from ${NGINX_IMAGE} \
--tag ${NGINX_IMAGE} \
--target nginx-prod \
./web

- name: "Publish web"
Expand All @@ -55,8 +55,8 @@ jobs:
for IMAGE_TAG in $(echo ${{ inputs.image-tags }})
do
echo "Tagging with $IMAGE_TAG"
docker tag $WEB_IMAGE $WEB_IMAGE:$IMAGE_TAG
docker push $WEB_IMAGE:$IMAGE_TAG
docker tag $NGINX_IMAGE $NGINX_IMAGE:$IMAGE_TAG
docker push $NGINX_IMAGE:$IMAGE_TAG
done

build-and-publish-api-main:
Expand Down Expand Up @@ -84,26 +84,3 @@ jobs:
docker tag $API_IMAGE $API_IMAGE:$IMAGE_TAG
docker push $API_IMAGE:$IMAGE_TAG
done

build-and-publish-nginx:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: "Login to image registry"
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login $IMAGE_REGISTRY -u $GITHUB_ACTOR --password-stdin

- name: "Build nginx"
run: |
docker pull $NGINX_IMAGE
docker build --cache-from $NGINX_IMAGE --tag $NGINX_IMAGE ./nginx

- name: "Publish nginx"
run: |
IFS=','
for IMAGE_TAG in $(echo ${{ inputs.image-tags }})
do
echo "Tagging with $IMAGE_TAG"
docker tag $NGINX_IMAGE $NGINX_IMAGE:$IMAGE_TAG
docker push $NGINX_IMAGE:$IMAGE_TAG
done