-
Notifications
You must be signed in to change notification settings - Fork 7
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 #65 from CodeForPhilly/helm-chart-2
Add helm chart (in project root) and files for static demo server
- Loading branch information
Showing
17 changed files
with
320 additions
and
29 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,68 @@ | ||
name: 'Containers: Publish' | ||
|
||
on: | ||
push: | ||
tags: [ 'v*' ] | ||
|
||
|
||
jobs: | ||
release-containers: | ||
name: Build and Push | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Login to ghcr.io Docker registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Compute Docker container image addresses | ||
run: | | ||
DOCKER_REPOSITORY="ghcr.io/${GITHUB_REPOSITORY,,}" | ||
DOCKER_TAG="${GITHUB_REF:11}" | ||
echo "DOCKER_REPOSITORY=${DOCKER_REPOSITORY}" >> $GITHUB_ENV | ||
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV | ||
echo "Using: ${DOCKER_REPOSITORY}/*:${DOCKER_TAG}" | ||
# - name: 'Pull previous Docker container image: :latest' | ||
# run: docker pull "${DOCKER_REPOSITORY}:latest" || true | ||
|
||
- name: 'Pull previous Docker container image: frontend-static:latest' | ||
run: docker pull "${DOCKER_REPOSITORY}/frontend-static:latest" || true | ||
|
||
- name: 'Build Docker container image: frontend-static:latest' | ||
run: | | ||
docker build \ | ||
--cache-from "${DOCKER_REPOSITORY}/frontend-static:latest" \ | ||
--file frontend/Dockerfile.demo \ | ||
--build-arg SERVER_NAME=localhost \ | ||
--tag "${DOCKER_REPOSITORY}/frontend-static:latest" \ | ||
--tag "${DOCKER_REPOSITORY}/frontend-static:${DOCKER_TAG}" \ | ||
frontend | ||
- name: 'Push Docker container image frontend-static:latest' | ||
run: docker push "${DOCKER_REPOSITORY}/frontend-static:latest" | ||
|
||
- name: 'Push Docker container image frontend-static:v*' | ||
run: docker push "${DOCKER_REPOSITORY}/frontend-static:${DOCKER_TAG}" | ||
# | ||
# | ||
# - name: 'Build Docker container image: backend:latest' | ||
# run: | | ||
# cd backend && \ | ||
# make && \ | ||
# docker image tag "${DOCKER_REPOSITORY}/backend/local:latest" "${DOCKER_REPOSITORY}/backend:latest" | ||
# | ||
# - name: Push Docker container image backend:latest | ||
# run: docker push "${DOCKER_REPOSITORY}/backend:latest" | ||
# | ||
# - name: Push Docker container image backend:v* | ||
# run: docker push "${DOCKER_REPOSITORY}/backend:${DOCKER_TAG}" | ||
|
||
# - name: Push Docker container image :v*" | ||
# run: docker push "${DOCKER_REPOSITORY}:${DOCKER_TAG}" |
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
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 |
---|---|---|
|
@@ -22,5 +22,3 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
.DS_Store |
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,38 @@ | ||
# This dockerfile builds an image for a static frontend only server suitable for online hosting. | ||
# Use the official Node.js image as the base image | ||
FROM node:18 as builder | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /usr/src/app | ||
|
||
# Copy package.json and package-lock.json | ||
COPY package*.json ./ | ||
|
||
# Set version number | ||
ARG FRONTEND_VERSION | ||
RUN npm version $FRONTEND_VERSION | ||
|
||
# Install dependencies | ||
RUN npm ci --legacy-peer-deps | ||
|
||
# Copy project files | ||
COPY . . | ||
|
||
RUN npm run build | ||
|
||
FROM alpine:latest as nginx-config | ||
RUN apk --no-cache add gettext | ||
WORKDIR /app | ||
COPY nginx.conf.demo ./nginx.conf.demo | ||
# This will get overwritten by helm chart | ||
|
||
ARG SERVER_NAME | ||
ENV SERVER_NAME $SERVER_NAME | ||
RUN cat nginx.conf.demo | envsubst > nginx.conf | ||
|
||
FROM nginx:alpine | ||
|
||
COPY --from=nginx-config /app/nginx.conf /etc/nginx/nginx.conf | ||
COPY --from=Builder /usr/src/app/dist /usr/share/nginx/html | ||
|
||
# The default entrypoint works for us. |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: "3.8" | ||
services: | ||
frontend-static: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.demo | ||
args: | ||
- IMAGE_NAME=frontend-static | ||
- FRONTEND_VERSION=0.0.2 | ||
- SERVER_NAME=localhost | ||
image: ghcr.io/codeforphilly/balancer-main/frontend-static:0.0.2 | ||
ports: | ||
- "80:80" | ||
environment: | ||
- CHOKIDAR_USEPOLLING=true | ||
- VITE_API_BASE_URL=https://devnull-as-a-service.com/dev/null |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# nginx config file for static frontend demo site. | ||
# This will be the nginx.conf in the docker image before it gets overwritten by kubernetes helm chart. | ||
user nginx; | ||
worker_processes 1; | ||
events { | ||
worker_connections 1024; | ||
} | ||
http { | ||
include /etc/nginx/mime.types; | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name $SERVER_NAME; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
} | ||
|
||
#error_page 404 /404.html; | ||
|
||
# redirect server error pages to the static page /50x.html | ||
# | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
} |
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,9 @@ | ||
name: nginx-helm-chart | ||
description: A generated Helm Chart for nginx-helm-chart from Skippbox Kompose | ||
version: 0.0.2 | ||
apiVersion: v2 | ||
keywords: | ||
- nginx-helm-chart | ||
sources: | ||
- https://github.com/CodeForPhilly/balancer-main | ||
home: https://opencollective.com/code-for-philly/projects/balancer |
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,2 @@ | ||
Chart initially created by Kompose from nginx-docker-compose.yml | ||
|
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,54 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
kompose.cmd: kompose convert -c -f nginx-docker-compose.yml -o nginx-helm-chart | ||
kompose.version: 1.31.2 (a92241f79) | ||
creationTimestamp: null | ||
labels: | ||
io.kompose.service: frontend-static | ||
name: frontend-static | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
io.kompose.service: frontend-static | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
annotations: | ||
kompose.cmd: kompose convert -c -f nginx-docker-compose.yml -o nginx-helm-chart | ||
kompose.version: 1.31.2 (a92241f79) | ||
creationTimestamp: null | ||
labels: | ||
io.kompose.network/frontend-default: "true" | ||
io.kompose.service: frontend-static | ||
spec: | ||
containers: | ||
- env: | ||
- name: CHOKIDAR_USEPOLLING | ||
value: "true" | ||
- name: VITE_API_BASE_URL | ||
value: {{ .Values.VITE_API_BASE_URL }} | ||
|
||
image: ghcr.io/codeforphilly/balancer-main/frontend-static:latest | ||
name: frontend-static | ||
ports: | ||
- containerPort: 80 | ||
protocol: TCP | ||
volumeMounts: | ||
- mountPath: /etc/nginx/nginx.conf | ||
name: nginx-conf | ||
subPath: nginx.conf | ||
readOnly: true | ||
resources: {} | ||
volumes: | ||
- name: nginx-conf | ||
configMap: | ||
name: nginx-conf | ||
items: | ||
- key: nginx.conf | ||
path: nginx.conf | ||
restartPolicy: Always | ||
status: {} |
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,19 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
kompose.cmd: kompose convert -c -f nginx-docker-compose.yml -o nginx-helm-chart | ||
kompose.version: 1.31.2 (a92241f79) | ||
creationTimestamp: null | ||
labels: | ||
io.kompose.service: frontend-static | ||
name: frontend-static | ||
spec: | ||
ports: | ||
- name: "http" | ||
port: 80 | ||
protocol: TCP | ||
selector: | ||
io.kompose.service: frontend-static | ||
status: | ||
loadBalancer: {} |
Oops, something went wrong.