Skip to content

Commit

Permalink
Merge pull request #2 from wisemen-digital/feature/github-actions
Browse files Browse the repository at this point in the history
GitHub actions
  • Loading branch information
jimchampagne authored Apr 8, 2024
2 parents 63abbee + 077f97d commit eca7b12
Show file tree
Hide file tree
Showing 11 changed files with 453 additions and 13 deletions.
27 changes: 27 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# General
**/.DS_Store
**/*.md
**/LICENSE
**/.vscode

# Git
**/.git
**/.github
**/.gitattributes
**/.gitignore

# Docker
**/.dockerignore
**/Dockerfile

# Node
**/.output
**/.nuxt
**/node_modules/
**/dist
**/npm-debug.log

# Local env files
.env
.env.*
!.env.example
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NUXT_PUBLIC_BASE_URL=http://localhost:3000
NUXT_PUBLIC_BASE_URL=
20 changes: 20 additions & 0 deletions .github/workflows/auto-deploy-to-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Auto-deploy to development

on: # yamllint disable-line rule:truthy
push:
branches: [main]
workflow_dispatch:

jobs:
build-and-deploy:
uses: wisemen-digital/devops-github-actions/.github/workflows/workflow-build-and-deploy-scaleway.yml@main
with:
environment: development
scaleway-container-registry: ${{ vars.CONTAINER_REGISTRY_ENDPOINT }}
scaleway-organization-id: ${{ vars.SCALEWAY_ORGANIZATION_ID }}
scaleway-project-id: ${{ vars.SCALEWAY_PROJECT_ID }}
scaleway-region: ${{ vars.SCALEWAY_REGION }}
scaleway-cluster-id: ${{ vars.K8S_CLUSTER_ID }}
cluster-deployments: ${{ vars.K8S_DEPLOYMENTS }}
secrets: inherit
28 changes: 28 additions & 0 deletions .github/workflows/promote-to-enviroment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Promote to enviroment

on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
environment:
description: Target environment to deploy TO
type: environment
required: true
source-tag:
description: Source tag (defaults to previous environment)
type: string
required: false

jobs:
promote-to-env:
uses: wisemen-digital/devops-github-actions/.github/workflows/workflow-promote-to-environment-scaleway.yml@main
with:
environment-source: ${{ inputs.source-tag }}
environment-target: ${{ inputs.environment }}
scaleway-container-registry: ${{ vars.CONTAINER_REGISTRY_ENDPOINT }}
scaleway-organization-id: ${{ vars.SCALEWAY_ORGANIZATION_ID }}
scaleway-project-id: ${{ vars.SCALEWAY_PROJECT_ID }}
scaleway-region: ${{ vars.SCALEWAY_REGION }}
scaleway-cluster-id: ${{ vars.K8S_CLUSTER_ID }}
cluster-deployments: ${{ vars.K8S_DEPLOYMENTS }}
secrets: inherit
13 changes: 13 additions & 0 deletions .github/workflows/pullrequest-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: PR Check

on: # yamllint disable-line rule:truthy
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main

jobs:
lint-build-test:
uses: wisemen-digital/devops-github-actions/.github/workflows/nuxt-build-and-test.yml@main
if: github.event.pull_request.draft == false
26 changes: 19 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
FROM node:20-alpine as build-stage
# Command line arguments, such as Node version
ARG NODE_VERSION=lts

#
# --- Stage 1: Build ---
#

FROM node:${NODE_VERSION} as build

RUN corepack enable pnpm

# Install dependencies
WORKDIR /app
COPY package.json pnpm-lock.yaml tsconfig.json .npmrc ./
RUN pnpm install --frozen-lockfile

# Copy files
COPY . .

RUN pnpm install --frozen-lockfile

# Build & optimize a bit
RUN pnpm run build

FROM node:20-alpine as production-stage
#
# --- Stage 2: Run ---
#

COPY --from=build-stage /app/.output .
FROM ghcr.io/wisemen-digital/nuxt-base:${NODE_VERSION} as final

EXPOSE 3000
ENTRYPOINT ["node", "./server/index.mjs"]
# Add application
COPY --from=build --chown=nobody /app/.output /app/www/
2 changes: 1 addition & 1 deletion assets/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ html {

body {
overflow-x: hidden;
letter-spacing: -.025em;
letter-spacing: -0.025em;
@apply font-primary bg-secondary;
}
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default defineNuxtConfig({
'@nuxtjs/i18n',
'@nuxtjs/tailwindcss',
'@vueuse/nuxt',
'@nuxt/test-utils/module',
],
i18n: {
strategy: 'prefix',
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "nuxt-app",
"type": "module",
"private": true,
"packageManager": "[email protected]",
"scripts": {
"build": "nuxt build",
"build_local": "nuxt build && node .output/server/index.mjs",
Expand All @@ -26,6 +27,7 @@
"@antfu/eslint-config": "2.11.0",
"@nuxt/devtools": "latest",
"@nuxt/image": "1.4.0",
"@nuxt/test-utils": "3.12.0",
"@nuxtjs/tailwindcss": "^6.11.4",
"@tailwindcss/typography": "^0.5.12",
"@vueuse/nuxt": "10.9.0",
Expand All @@ -34,6 +36,7 @@
"eslint-plugin-tailwindcss": "3.15.1",
"sass": "1.72.0",
"typescript": "5.4.3",
"vitest": "1.4.0",
"vue-tsc": "2.0.7"
}
}
Loading

0 comments on commit eca7b12

Please sign in to comment.