-
Notifications
You must be signed in to change notification settings - Fork 0
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 #218 from jackstockley89/helm
feat(helm): Update templates
- Loading branch information
Showing
11 changed files
with
96 additions
and
279 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 |
---|---|---|
@@ -1,32 +1,40 @@ | ||
FROM golang:1.17.8-alpine3.15 | ||
FROM golang:1.19.3-alpine3.16 | ||
|
||
RUN apk add git | ||
RUN apk add postgresql-client | ||
ENV \ | ||
CGO_ENABLED=0 \ | ||
GOOS=linux | ||
|
||
RUN go get -u github.com/lib/pq | ||
RUN go get -u github.com/joho/godotenv | ||
RUN apk add postgresql-client | ||
|
||
RUN addgroup -g 1000 -S appgroup && \ | ||
adduser -u 1000 -S appuser -G appgroup | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
COPY go.mod /app | ||
COPY go.sum /app | ||
COPY main.go /app | ||
COPY sql /app | ||
COPY static /app | ||
COPY templates /app | ||
COPY .env_db /app | ||
COPY .env_app /app | ||
|
||
RUN chown -R appuser:appgroup /app | ||
RUN chown -R appuser:appgroup /go/bin | ||
USER 1000 | ||
|
||
RUN go mod download | ||
|
||
RUN echo ${PGPASSFILE} > /home/appuser/.pgpass && \ | ||
chown appuser:appgroup /home/appuser/.pgpass && \ | ||
chmod 0600 /home/appuser/.pgpass | ||
|
||
RUN chown -R appuser:appgroup /app | ||
RUN chown -R appuser:appgroup /go | ||
|
||
USER 1000 | ||
|
||
# Build the Go app | ||
RUN go build -o main . | ||
RUN go build -ldflags "-s -w" -o /go/bin/cycling_blog -buildvcs=false | ||
|
||
# Expose port 8080 to the outside world | ||
EXPOSE 8080 | ||
|
||
# Command to run the executable | ||
CMD ["./main"] | ||
CMD ["cycling_blog"] |
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,63 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ .Values.cycling_blog_db_create.name }} | ||
namespace: {{ .Values.namespace }} | ||
labels: | ||
app: {{ .Values.cycling_blog_db_create.app }} | ||
annotations: | ||
# This is what defines this resource as a hook. Without this line, the | ||
# job is considered part of the release. | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-weight": "5" | ||
"helm.sh/hook-delete-policy": {{ .Values.annotations.hookDeletePolicy }} | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: {{ .Values.cycling_blog_db_create.app }} | ||
image: {{ .Values.app_deployment.template.containers.image }} | ||
imagePullPolicy: {{ .Values.cycling_blog_db_create.template.containers.imagePullPolicy }} | ||
command: ["psql"] | ||
args: ["-h", "$(CYCLING_BLOG_DB_SERVICE_SERVICE_HOST)", "-U", "$(POSTGRES_USER)", "-d", "$(POSTGRES_DB)", "-w", "-a", "-f", "sql/create_table.sql"] | ||
env: | ||
{{- range .Values.db_env }} | ||
- name: {{ .name }} | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .secretName }} | ||
key: {{ .key }} | ||
{{- end }} | ||
restartPolicy: {{ .Values.cycling_blog_db_create.template.restartPolicy }} | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ .Values.cycling_blog_db_insert.name }} | ||
namespace: {{ .Values.namespace }} | ||
labels: | ||
app: {{ .Values.cycling_blog_db_insert.app }} | ||
annotations: | ||
# This is what defines this resource as a hook. Without this line, the | ||
# job is considered part of the release. | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-weight": "10" | ||
"helm.sh/hook-delete-policy": {{ .Values.annotations.hookDeletePolicy }} | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: {{ .Values.cycling_blog_db_insert.app }} | ||
image: {{ .Values.app_deployment.template.containers.image }} | ||
imagePullPolicy: {{ .Values.cycling_blog_db_insert.template.containers.imagePullPolicy }} | ||
command: ["psql"] | ||
args: ["-h", "$(CYCLING_BLOG_DB_SERVICE_SERVICE_HOST)", "-U", "$(POSTGRES_USER)", "-d", "$(POSTGRES_DB)", "-w", "-a", "-f", "sql/table_insert.sql"] | ||
env: | ||
{{- range .Values.db_env }} | ||
- name: {{ .name }} | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .secretName }} | ||
key: {{ .key }} | ||
{{- end }} | ||
restartPolicy: {{ .Values.cycling_blog_db_insert.template.restartPolicy }} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.