-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from DSC-McMaster-U/dockfile_frontend
Dockerfile running for frontend and Secrets for Terraform
- Loading branch information
Showing
7 changed files
with
110 additions
and
142 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,52 @@ | ||
name: 'Manual Terraform Deployment' | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: 'Target environment' | ||
required: true | ||
default: 'dev' | ||
|
||
jobs: | ||
terraform: | ||
name: 'Deploy to Environment' | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: ${{ github.event.inputs.environment }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Google Cloud SDK | ||
uses: google-github-actions/[email protected] | ||
with: | ||
service_account_key: ${{ secrets.DEFAULT_SA_KEY }} | ||
project_id: ${{ secrets.PROJECT_ID }} | ||
|
||
- name: Install Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
|
||
- name: Set up Terraform credentials | ||
run: | | ||
echo "GOOGLE_CREDENTIALS=${{ secrets.DEFAULT_SA_KEY }}" >> $GITHUB_ENV | ||
- name: Terraform Init | ||
run: terraform init | ||
|
||
- name: Terraform Plan | ||
run: terraform plan -out=tfplan | ||
|
||
- name: Hold for approval | ||
if: github.event_name == 'workflow_dispatch' | ||
uses: softprops/turnstyle@v1 | ||
with: | ||
continue-after-seconds: 0 # This will make it wait indefinitely until manually approved | ||
poll-interval-seconds: 10 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Terraform Apply | ||
if: github.event_name == 'workflow_dispatch' | ||
run: terraform apply tfplan |
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,3 +1,3 @@ | ||
{ | ||
"extends": ["next/babel", "next/core-web-vitals"] | ||
"extends": ["next", "next/core-web-vitals"] | ||
} |
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,35 @@ | ||
# Stage 1: Building the code | ||
FROM node:16-alpine AS builder | ||
|
||
WORKDIR /app | ||
|
||
# Copy the package.json and package-lock.json | ||
COPY package*.json ./ | ||
|
||
# Install dependencies | ||
RUN npm ci --only=production | ||
|
||
# Copy the app source code | ||
COPY . . | ||
|
||
# Build the app | ||
RUN npm run build | ||
|
||
# Stage 2: Run the app | ||
FROM node:16-alpine AS runner | ||
WORKDIR /app | ||
|
||
# Copy built assets from the builder stage | ||
COPY --from=builder /app/.next/ .next/ | ||
COPY --from=builder /app/node_modules/ node_modules/ | ||
COPY --from=builder /app/public/ public/ | ||
COPY --from=builder /app/package.json package.json | ||
|
||
# Expose the port Next.js runs on | ||
EXPOSE 3000 | ||
|
||
# Set environment to production to avoid including unnecessary files | ||
ENV NODE_ENV production | ||
|
||
# Start the app | ||
CMD ["npm", "start"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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