Skip to content

Commit

Permalink
Merge pull request #2 from bullet-ant/app
Browse files Browse the repository at this point in the history
Adds Svelte App
  • Loading branch information
bullet-ant authored Sep 15, 2024
2 parents e125b83 + 017b66c commit 03d785d
Show file tree
Hide file tree
Showing 18 changed files with 1,425 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and Push Docker Image

on:
push:
branches:
- app

jobs:
build:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the latest code from the repo
- name: Checkout code
uses: actions/checkout@v4

# Step 2: Install jq to parse package.json
- name: Install jq
run: sudo apt-get install -y jq

# Step 3: Set up Docker in the workflow
- name: Set up Docker
uses: docker/setup-buildx-action@v3

# Step 4: Log in to Docker Hub using secrets
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

# Step 5: Extract version from package.json
- name: Extract version from package.json
id: get_version
run: |
VERSION=$(cat app/package.json | jq -r .version)
echo "VERSION=$VERSION"
echo "::set-output name=version::$VERSION"
# Step 6: Build Docker image with version tag
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_USER }}/gitops-app:${{ steps.get_version.outputs.version }} app/.
# Step 7: Push Docker image to Docker Hub
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKER_USER }}/gitops-app:${{ steps.get_version.outputs.version }}
5 changes: 5 additions & 0 deletions app/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
build
Dockerfile
.dockerfile
24 changes: 24 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
3 changes: 3 additions & 0 deletions app/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["svelte.svelte-vscode"]
}
24 changes: 24 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Stage 1

FROM node:18-alpine AS build

WORKDIR /app

COPY package*.json /app/

RUN npm install

COPY . /app/

RUN npm run build


# Stage 2

FROM nginx:alpine

COPY --from=build /app/dist /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
Empty file added app/README.md
Empty file.
16 changes: 16 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>v1</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>

</html>
32 changes: 32 additions & 0 deletions app/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"compilerOptions": {
"moduleResolution": "bundler",
"target": "ESNext",
"module": "ESNext",
/**
* svelte-preprocess cannot figure out whether you have
* a value or a type, so tell TypeScript to enforce using
* `import type` instead of `import` for Types.
*/
"verbatimModuleSyntax": true,
"isolatedModules": true,
"resolveJsonModule": true,
/**
* To have warnings / errors of the Svelte compiler at the
* correct position, enable source maps by default.
*/
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
/**
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable this if you'd like to use dynamic types.
*/
"checkJs": true
},
/**
* Use global.d.ts instead of compilerOptions.types
* to avoid limiting type declarations.
*/
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
}
Loading

0 comments on commit 03d785d

Please sign in to comment.