Skip to content

Commit 99ce164

Browse files
Merge pull request #58 from CodeForPhilly/develop
Release: v0.1.10
2 parents ee69103 + 4e25084 commit 99ce164

File tree

6 files changed

+125
-12
lines changed

6 files changed

+125
-12
lines changed

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
services:
33
app:
4-
image: node:18-slim
54
build:
65
context: ./src/app
76
dockerfile: Dockerfile
7+
target: environment
88
working_dir: /usr/local/src
99
environment:
1010
- PORT=4321
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "third-places.fullname" . }}-frontend
5+
labels:
6+
{{- include "third-places.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: frontend
8+
spec:
9+
replicas: {{ .Values.replicaCount }}
10+
selector:
11+
matchLabels:
12+
{{- include "third-places.selectorLabels" . | nindent 6 }}
13+
app.kubernetes.io/component: frontend
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "third-places.selectorLabels" . | nindent 8 }}
22+
app.kubernetes.io/component: frontend
23+
spec:
24+
{{- with .Values.imagePullSecrets }}
25+
imagePullSecrets:
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
containers:
29+
- name: {{ .Chart.Name }}-frontend
30+
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}"
31+
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
32+
ports:
33+
- name: http
34+
containerPort: 80
35+
protocol: TCP
36+
livenessProbe:
37+
httpGet:
38+
path: /
39+
port: http
40+
readinessProbe:
41+
httpGet:
42+
path: /
43+
port: http
44+
resources:
45+
{{- toYaml .Values.resources | nindent 12 }}
46+
{{- with .Values.nodeSelector }}
47+
nodeSelector:
48+
{{- toYaml . | nindent 8 }}
49+
{{- end }}
50+
{{- with .Values.affinity }}
51+
affinity:
52+
{{- toYaml . | nindent 8 }}
53+
{{- end }}
54+
{{- with .Values.tolerations }}
55+
tolerations:
56+
{{- toYaml . | nindent 8 }}
57+
{{- end }}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "third-places.fullname" . }}-frontend
5+
labels:
6+
{{- include "third-places.labels" . | nindent 4 }}
7+
app.kubernetes.io/component: frontend
8+
spec:
9+
type: ClusterIP
10+
ports:
11+
- port: 80
12+
targetPort: http
13+
protocol: TCP
14+
name: http
15+
selector:
16+
{{- include "third-places.selectorLabels" . | nindent 4 }}
17+
app.kubernetes.io/component: frontend

helm-chart/templates/ingress.yaml

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{{- if .Values.ingress.enabled -}}
22
{{- $fullName := include "third-places.fullname" . -}}
3-
{{- $svcPort := .Values.service.port -}}
43
apiVersion: networking.k8s.io/v1
54
kind: Ingress
65
metadata:
@@ -33,12 +32,26 @@ spec:
3332
paths:
3433
{{- range .paths }}
3534
- path: {{ . }}
35+
pathType: Prefix
36+
backend:
37+
service:
38+
name: {{ $fullName }}-frontend
39+
port:
40+
name: http
41+
- path: {{ . | trimSuffix "/" }}/api/
42+
pathType: Prefix
43+
backend:
44+
service:
45+
name: {{ $fullName }}
46+
port:
47+
name: http
48+
- path: {{ . | trimSuffix "/" }}/admin/
3649
pathType: Prefix
3750
backend:
3851
service:
3952
name: {{ $fullName }}
4053
port:
41-
number: {{ $svcPort }}
54+
name: http
4255
{{- end }}
4356
{{- end }}
4457
{{- end }}

helm-chart/values.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ tolerations: []
5454

5555
affinity: {}
5656

57+
frontend:
58+
image:
59+
repository: ghcr.io/codeforphilly/third-places/frontend
60+
pullPolicy: IfNotPresent
61+
# Overrides the image tag whose default is the chart appVersion.
62+
tag: 0.1.2
63+
5764
postgresql:
5865
image:
5966
repository: postgis/postgis

src/app/Dockerfile

+28-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
1-
FROM node:18-slim
2-
ARG HOME=usr/local/src/
3-
WORKDIR $HOME
1+
## Target: environment
2+
#
3+
# This initially-empty target provides an environment for docker-compose
4+
# to start from the same base as the production builder environment. Common
5+
# dependencies could be added here
6+
#
7+
FROM node:18-slim as environment
48

5-
COPY entrypoint.sh /entrypoint.sh
6-
RUN chmod +x /entrypoint.sh
79

8-
ADD . .
9-
ENTRYPOINT [ "/entrypoint.sh" ]
10-
CMD ["npm", "run", "dev", "--host"]
11-
EXPOSE 4321
10+
## Target: builder
11+
#
12+
# This target builds /src/dist with layers optimized for caching dependencies
13+
#
14+
FROM environment as builder
15+
WORKDIR /src
16+
17+
COPY package*.json ./
18+
RUN npm ci
19+
20+
COPY * ./
21+
RUN npm run build
22+
23+
24+
## Target: runtime
25+
#
26+
# This target provides an nginx web server wrapped around the static
27+
# website build from the builder target
28+
#
29+
FROM nginx:alpine as runtime
30+
COPY --from=builder /src/dist /usr/share/nginx/html

0 commit comments

Comments
 (0)