Skip to content

Commit 738a018

Browse files
committed
Initial version
1 parent 1bd23f7 commit 738a018

File tree

13 files changed

+1236
-0
lines changed

13 files changed

+1236
-0
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
indent_size = 4
10+
indent_style = space
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.yaml]
15+
indent_size = 2
16+
17+
[*.json]
18+
indent_size = 2

.github/workflows/gcr-deploy.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
workflow_dispatch:
9+
10+
# Environment variables available to all jobs and steps in this workflow
11+
# NOTE: these aren't really secret, but there aren't non-secret settings
12+
env:
13+
RUN_PROJECT: ${{ secrets.RUN_PROJECT }}
14+
RUN_REGION: ${{ secrets.RUN_REGION }}
15+
RUN_SERVICE: ${{ secrets.RUN_SERVICE }}
16+
17+
jobs:
18+
deploy:
19+
name: Deploy to CloudRun
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: gcloud auth
27+
id: 'auth'
28+
uses: 'google-github-actions/auth@v2'
29+
with:
30+
credentials_json: '${{ secrets.GCP_SA_KEY }}'
31+
32+
# Setup gcloud CLI
33+
- name: gcloud setup
34+
uses: google-github-actions/setup-gcloud@v2
35+
36+
- name: gcloud docker-auth
37+
run: gcloud auth configure-docker
38+
39+
# Build and push image to Google Container Registry
40+
- name: Build
41+
run: |
42+
docker build \
43+
--build-arg COMMIT=${GITHUB_SHA:0:7} \
44+
--build-arg LASTMOD=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
45+
--tag gcr.io/${RUN_PROJECT}/${RUN_SERVICE}:$GITHUB_SHA \
46+
.
47+
48+
- name: GCloud auth to docker
49+
run: |
50+
gcloud auth configure-docker
51+
52+
- name: Push to registry
53+
run: |
54+
docker push gcr.io/${RUN_PROJECT}/${RUN_SERVICE}:$GITHUB_SHA
55+
56+
# Deploy image to Cloud Run
57+
- name: Deploy
58+
run: |
59+
gcloud run deploy ${RUN_SERVICE} \
60+
--allow-unauthenticated \
61+
--image gcr.io/${RUN_PROJECT}/${RUN_SERVICE}:$GITHUB_SHA \
62+
--platform managed \
63+
--project ${RUN_PROJECT} \
64+
--region ${RUN_REGION}

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*~
2+
.cache
3+
dist
4+
.DS_Store
5+
*.env
6+
*.gz
7+
jspm_packages/
8+
logs
9+
*.log
10+
node_modules/
11+
.swp
12+
*.tgz
13+
tmp
14+
*.tmp
15+
*.zip

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM denoland/deno:debian AS builder
2+
3+
WORKDIR /app
4+
5+
COPY . .
6+
7+
RUN deno compile \
8+
--allow-env \
9+
--allow-net \
10+
--allow-read \
11+
src/server.ts
12+
13+
14+
FROM gcr.io/distroless/cc
15+
16+
USER nonroot
17+
WORKDIR /app
18+
ARG COMMIT="(not set)"
19+
ARG LASTMOD="(not set)"
20+
ENV COMMIT=$COMMIT
21+
ENV LASTMOD=$LASTMOD
22+
23+
COPY --from=builder /app/server /app/server
24+
COPY ./static /app/static
25+
26+
ENV PORT=4000
27+
ENV HOSTNAME=0.0.0.0
28+
29+
CMD ["/app/server"]

0 commit comments

Comments
 (0)