Skip to content

Commit

Permalink
Merge pull request #58 from CodeForPhilly/develop
Browse files Browse the repository at this point in the history
Release: v0.1.10
  • Loading branch information
themightychris authored May 10, 2023
2 parents ee69103 + 4e25084 commit 99ce164
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
services:
app:
image: node:18-slim
build:
context: ./src/app
dockerfile: Dockerfile
target: environment
working_dir: /usr/local/src
environment:
- PORT=4321
Expand Down
57 changes: 57 additions & 0 deletions helm-chart/templates/frontend/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "third-places.fullname" . }}-frontend
labels:
{{- include "third-places.labels" . | nindent 4 }}
app.kubernetes.io/component: frontend
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "third-places.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: frontend
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "third-places.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: frontend
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-frontend
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
17 changes: 17 additions & 0 deletions helm-chart/templates/frontend/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "third-places.fullname" . }}-frontend
labels:
{{- include "third-places.labels" . | nindent 4 }}
app.kubernetes.io/component: frontend
spec:
type: ClusterIP
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
selector:
{{- include "third-places.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: frontend
17 changes: 15 additions & 2 deletions helm-chart/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "third-places.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
Expand Down Expand Up @@ -33,12 +32,26 @@ spec:
paths:
{{- range .paths }}
- path: {{ . }}
pathType: Prefix
backend:
service:
name: {{ $fullName }}-frontend
port:
name: http
- path: {{ . | trimSuffix "/" }}/api/
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
name: http
- path: {{ . | trimSuffix "/" }}/admin/
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
name: http
{{- end }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ tolerations: []

affinity: {}

frontend:
image:
repository: ghcr.io/codeforphilly/third-places/frontend
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: 0.1.2

postgresql:
image:
repository: postgis/postgis
Expand Down
37 changes: 28 additions & 9 deletions src/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
FROM node:18-slim
ARG HOME=usr/local/src/
WORKDIR $HOME
## Target: environment
#
# This initially-empty target provides an environment for docker-compose
# to start from the same base as the production builder environment. Common
# dependencies could be added here
#
FROM node:18-slim as environment

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ADD . .
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["npm", "run", "dev", "--host"]
EXPOSE 4321
## Target: builder
#
# This target builds /src/dist with layers optimized for caching dependencies
#
FROM environment as builder
WORKDIR /src

COPY package*.json ./
RUN npm ci

COPY * ./
RUN npm run build


## Target: runtime
#
# This target provides an nginx web server wrapped around the static
# website build from the builder target
#
FROM nginx:alpine as runtime
COPY --from=builder /src/dist /usr/share/nginx/html

0 comments on commit 99ce164

Please sign in to comment.