This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
generated from OpenSaasAU/monorepo-starter
-
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.
- Loading branch information
Showing
45 changed files
with
13,823 additions
and
1,797 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,75 @@ | ||
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | ||
# More GitHub Actions for Azure: https://github.com/Azure/actions | ||
|
||
name: Build and deploy Node.js app to Azure Web App - pantryadmin | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
env: | ||
BACKEND_BASE_URL: http://localhost:3000 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js version | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Log in to registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: https://collectivereg.azurecr.io/ | ||
username: ${{ secrets.AzureAppService_ContainerUsername_28d39508e5734f558fc68a409d6d0fac }} | ||
password: ${{ secrets.AzureAppService_ContainerPassword_807a7babf8fc4bbab3814a0bd2d77375 }} | ||
|
||
- name: Build and push container image to registry | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: collectivereg.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_28d39508e5734f558fc68a409d6d0fac }}/pantry-backend:${{ github.sha }} | ||
file: ./backend/Dockerfile | ||
|
||
- name: Build and push container image to registry | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: collectivereg.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_e63bb1905c6a4a45b5a231dfb2e20209 }}/pantry-frontend:${{ github.sha }} | ||
file: ./apps/Dockerfile | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
environment: | ||
name: "Production" | ||
url: ${{ steps.frontend-to-webapp.outputs.webapp-url }} | ||
|
||
steps: | ||
- name: Deploy Backend to Azure Web App | ||
id: backend-to-webapp | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: "pantryadmin-docker" | ||
slot-name: "production" | ||
publish-profile: ${{ secrets.AzureAppService_PublishProfile_d7e475cd12ae435193e3f0efff1d8394 }} | ||
images: "collectivereg.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_28d39508e5734f558fc68a409d6d0fac }}/pantry-backend:${{ github.sha }}" | ||
|
||
- name: Deploy Frontend to Azure Web App | ||
id: frontend-to-webapp | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: "pantryfrontend" | ||
slot-name: "production" | ||
publish-profile: ${{ secrets.AzureAppService_PublishProfile_4d2ccba4715b4bfe9af97028f357c793 }} | ||
images: "collectivereg.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_e63bb1905c6a4a45b5a231dfb2e20209 }}/pantry-frontend:${{ github.sha }}" |
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,13 +1,27 @@ | ||
FROM node:16-alpine AS builder | ||
RUN apk update | ||
# Set working directory | ||
WORKDIR /app | ||
RUN yarn global add turbo | ||
COPY . . | ||
RUN turbo prune --scope=@opensaas-clubhouse/frontend --docker | ||
|
||
FROM node:16.13-alpine AS deps | ||
ARG APP=next-app | ||
RUN npm i -g pnpm | ||
WORKDIR /usr/app | ||
COPY ".npmrc" . | ||
COPY ["./apps/${APP}/package.json", "pnpm-lock.*", "./"] | ||
RUN pnpm install | ||
# Add lockfile and package.json's of isolated subworkspace | ||
FROM node:16-alpine AS installer | ||
RUN apk update | ||
WORKDIR /app | ||
COPY --from=builder /app/out/json/ . | ||
COPY --from=builder /app/out/yarn.lock ./yarn.lock | ||
RUN yarn install | ||
|
||
FROM node:16-alpine AS sourcer | ||
RUN apk update | ||
WORKDIR /app | ||
COPY --from=installer /app/ . | ||
COPY --from=builder /app/out/full/ . | ||
COPY .gitignore .gitignore | ||
ENV NODE_ENV=production | ||
COPY ./apps/${APP}/. . | ||
RUN pnpm build | ||
ENV BACKEND_BASE_URL=http://localhost:3000 | ||
RUN yarn turbo run build --scope=@opensaas-clubhouse/frontend --include-dependencies --no-deps | ||
EXPOSE 3000 | ||
CMD ["pnpm", "start"] | ||
CMD ["yarn", "start"] |
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,34 +1,31 @@ | ||
import { signIn, signOut, useSession } from "next-auth/react"; | ||
import { Navbar, Nav, Button } from "react-bootstrap"; | ||
import Link from "next/link"; | ||
import { signIn, signOut, useSession } from 'next-auth/react'; | ||
import { Navbar, Nav, Button } from 'react-bootstrap'; | ||
import Link from 'next/link'; | ||
|
||
export function SigninButton() { | ||
export function SigninButton({ ...props }) { | ||
const { returnUrl } = props; | ||
const { data, status } = useSession(); | ||
if (!data) | ||
return ( | ||
<Button | ||
onClick={() => | ||
signIn('azure-ad-b2c', { | ||
callbackUrl: `${window.location.origin}${returnUrl || '/'}`, | ||
}) | ||
} | ||
> | ||
Get Started/Sign In | ||
</Button> | ||
); | ||
return ( | ||
<> | ||
{!data ? ( | ||
<Button | ||
onClick={() => | ||
signIn("auth0", { | ||
callbackUrl: `${window.location.origin}`, | ||
}) | ||
} | ||
> | ||
Sign In | ||
</Button> | ||
) : ( | ||
<> | ||
<Button | ||
onClick={() => | ||
signOut({ | ||
callbackUrl: `${window.location.origin}`, | ||
}) | ||
} | ||
> | ||
Sign Out | ||
</Button> | ||
</> | ||
)} | ||
</> | ||
<Button | ||
onClick={() => | ||
signOut({ | ||
callbackUrl: `${window.location.origin}`, | ||
}) | ||
} | ||
> | ||
Sign Out | ||
</Button> | ||
); | ||
} |
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,34 @@ | ||
import { signIn, signOut, useSession } from 'next-auth/react'; | ||
import { Navbar, Nav, Button } from 'react-bootstrap'; | ||
import Link from 'next/link'; | ||
|
||
export function SignupButton() { | ||
const { data, status } = useSession(); | ||
if (!data) | ||
return ( | ||
<Button | ||
onClick={() => | ||
signIn( | ||
'azure-ad-b2c', | ||
{ | ||
callbackUrl: `${window.location.origin}`, | ||
}, | ||
{ p: 'B2C_1_oldhcurchpantrysignup' } | ||
) | ||
} | ||
> | ||
Sign Up | ||
</Button> | ||
); | ||
return ( | ||
<Button | ||
onClick={() => | ||
signOut({ | ||
callbackUrl: `${window.location.origin}`, | ||
}) | ||
} | ||
> | ||
Sign Out | ||
</Button> | ||
); | ||
} |
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
Oops, something went wrong.