Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧰infra: apply for lambda #171

Merged
merged 10 commits into from
Feb 16, 2024
53 changes: 53 additions & 0 deletions .github/workflows/lambda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy to Amazon Lambda

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- main
paths:
- "app/**"
- "public/**"
- "bun.lockb"
- "package.json"
- "yarn.lock"
- "*config.*"
workflow_dispatch:

env:
AWS_REGION: ap-northeast-1
ECR_REPOSITORY: caravan-kidstec
LAMBDA_FUNCTION_NAME: caravan-kidstec

jobs:
deploy:
if: github.repository == 'OpenUp-LabTakizawa/caravan-kidstec'
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
aws lambda update-function-code --function-name $LAMBDA_FUNCTION_NAME --image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ RUN bun run build

FROM oven/bun:canary-distroless
WORKDIR /usr/src/app
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.1 /lambda-adapter /opt/extensions/lambda-adapter

ENV NODE_ENV=production
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nonroot:nonroot /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static

USER nonroot
EXPOSE 80
ENV PORT 80
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
CMD ["run", "server.js"]
Binary file modified bun.lockb
Binary file not shown.
156 changes: 78 additions & 78 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
# bun ./bun.lockb --hash: 4ED23A91F4C7EA11-2fc3fc66dd5a3be3-F4041473B82088DC-5db74cbfb3fd05df
# bun ./bun.lockb --hash: 2CB551630D7F6344-2a1ad0db074f08c6-CDBFDCB65BA1EEED-a333c53c99e666de


"@alloc/quick-lru@^5.2.0":
Expand Down Expand Up @@ -142,55 +142,55 @@
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"

"@next/[email protected].54":
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/@next/env/-/env-14.1.1-canary.54.tgz"
integrity sha512-YaLOEFgbGaZCtrwpqW4E7Y3FQVOB/cp+g93a2BnGk/pWPbkMMg3vrtMAd/7p3Hbzr/TiAg8Uuy6A2uHIL6CROA==

"@next/[email protected].54":
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.1-canary.54.tgz"
integrity sha512-c9H5fpL3j0cVfZ8PhKd9I2a7scmtC5QwrwtG3N+qaWKYCaawR03gC3oRFoXFQgB4cICKsgtZ6hea0fn6xi3TYQ==

"@next/[email protected].54":
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.1-canary.54.tgz"
integrity sha512-IkOsCNfMQZTUG/bDTg2QWtZbY/OGFsNhfhwi+1MnbmnbA95+ernPX7tJl+veBuLUEFe+lxEVPngZDvUZU3DIjQ==

"@next/[email protected].54":
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.1-canary.54.tgz"
integrity sha512-UiIyiPD8eBxlOu+vHjPtECB1IT7qnsysGCPKpTTFNt67ENsjkqdprNVAgVcN8BJbOsAZEsudK8WT67rDNGrrZQ==

"@next/[email protected].54":
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.1-canary.54.tgz"
integrity sha512-RenLi+h+A8g0/XYL6PAzdorgwPsnA094EsmhsQdI8qgf5oHnpkR6WCa4hzJgODs2TghZg9dPqDOGErA7chFd8A==

"@next/[email protected].54":
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.1-canary.54.tgz"
integrity sha512-VBGbm4y6wAf7nnJLznltnbWHu068xIT7MJE4ezAUs8Nk9+bxWStDE6tudWB8K6A+c39/79kX79QVvDv3A5A4+A==

"@next/[email protected].54":
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.1-canary.54.tgz"
integrity sha512-YKufA1FOpIC081o1UnioIUJdmboFOJyvvalWAMX5tvdOdC8BNti2sm6tnl8+zRTMz92OjAch+R4O1/l9Qd/SQQ==

"@next/[email protected].54":
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.1-canary.54.tgz"
integrity sha512-EYrV3xRI35qeN7zW9/OZ6iYd9NpWq0tsVNLHNeBRU2MmuGuMAgR59lB47eb0fV20LnpXQJCybtxqWZOvyy9QiQ==

"@next/[email protected].54":
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.1-canary.54.tgz"
integrity sha512-sMxEwl64bEe35iJ1jxZpB4K3vf+zHY0pvMueYEZDSMEC+42qCqk0XtVNn129aWPNA/n5dNG6pcxKNYRS6XesEA==

"@next/[email protected].54":
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.1-canary.54.tgz"
integrity sha512-UyisjAS2lHKTjKy9gRWlNN9zgFhJCvFG/jtExEq1Ozq1qmAsWUEmgWQNmPFZfNbJ0stc43rgOC7U8NOOFtRXRw==
"@next/[email protected].56":
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/@next/env/-/env-14.1.1-canary.56.tgz"
integrity sha512-2C+38wg1ZTb9N3HagtLZIjhPg0cbB97PmbgAKLMg+QOttyjmBiVjb231XWHKjqoEhY9u/ILWNbzgQ8gD5JplkA==

"@next/[email protected].56":
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.1-canary.56.tgz"
integrity sha512-xqCZidAakgTw0iQaWK3IRgbu1o8i2dRFjLkvAF1QPZruVFlSaCIKoSo3GUebJcrvzcHVzRkDKnr+FlWLmES5zA==

"@next/[email protected].56":
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.1-canary.56.tgz"
integrity sha512-febsltDU+jnNhK3qZriJ58FSmyZtJkOtih5t0VDusgM8MdfwVfcfv0kMVSZOygdWrJLhml5OKBC4XdX4BDGpEw==

"@next/[email protected].56":
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.1-canary.56.tgz"
integrity sha512-4Zj09znOpXxU6y2BBVEo5jfa4aeiJVg5d4dbcAnuDL7n26xzQL62UOXflSLdijZ8842qcIUN5SQa1kqZlixj+w==

"@next/[email protected].56":
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.1-canary.56.tgz"
integrity sha512-CfDodJ/hjqdYYDpVZ0Jxjab8lmrl74Z3Y1tp12lzZA3jnrjXq66Wj8ckQ81H+Omn4ObovpMD+DRL8/xKXdC7HQ==

"@next/[email protected].56":
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.1-canary.56.tgz"
integrity sha512-tHUaCQOaFxuUWR/7tvnFQTNOVKmmtKE2SdNfh5rzYz00JjYhVf3aR9hqOvCBmck0LJ77FmZK+8pBwUb8Jouz9g==

"@next/[email protected].56":
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.1-canary.56.tgz"
integrity sha512-OEdHeNFb7BM+byb6JrpLF9/na2oCpxNbC6n+zQHcM/CV/y2OBniz9JDngckJG3esfnD6q9aCjEEt6LF9/LKZyw==

"@next/[email protected].56":
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.1-canary.56.tgz"
integrity sha512-qWVDIia8BJ8209XUVw4QNPi4mup2OwRZVLlrD1WZwAmDGy5p/gwFqGCvQ5BeiCUl8Et9xWsVwou1/n5mobj0Dw==

"@next/[email protected].56":
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.1-canary.56.tgz"
integrity sha512-e26LjHCGlg/X6iS5iqILGykgAFM+hLoNP1HTpsEXebn8iOaAJ4w2YEyk5+CGk4aImM9YwXGsquPWq/S+SwVMaQ==

"@next/[email protected].56":
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.1-canary.56.tgz"
integrity sha512-ylkY6s0wXjS8V7e7fFLtkT+VY0oLfZUDDdLPBL1hDxjh3m4H2kKB+Hq67fkRem7DoF3zn1pqCjbz4Gby/nXisg==

"@nodelib/[email protected]":
version "2.1.5"
Expand Down Expand Up @@ -267,9 +267,9 @@
bun-types "1.0.26"

"@types/node@*", "@types/node@^20.11.17", "@types/node@~20.11.3":
version "20.11.17"
resolved "https://registry.npmjs.org/@types/node/-/node-20.11.17.tgz"
integrity sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==
version "20.11.19"
resolved "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz"
integrity sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==
dependencies:
undici-types "~5.26.4"

Expand Down Expand Up @@ -1038,27 +1038,27 @@ nanoid@^3.3.6, nanoid@^3.3.7:
integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==

next@canary:
version "14.1.1-canary.54"
resolved "https://registry.npmjs.org/next/-/next-14.1.1-canary.54.tgz"
integrity sha512-upsM73QNXv4rPg8QUbReEQ3uB/KMcEM6suRTNYHbjmqWBAY7J6jLW5aHGUDipfBlRsy/4HdU4m0dpcKqcDJniQ==
version "14.1.1-canary.56"
resolved "https://registry.npmjs.org/next/-/next-14.1.1-canary.56.tgz"
integrity sha512-/rqfqDzofP3xoOlGsRZXSc9eDBRn+f6UTIrJepappiFIJ2Bk54xVgQV+0HWG7szQoYt1tf+ZYCK1+h46/y5/oA==
dependencies:
"@next/env" "14.1.1-canary.54"
"@next/env" "14.1.1-canary.56"
"@swc/helpers" "0.5.5"
busboy "1.6.0"
caniuse-lite "^1.0.30001579"
graceful-fs "^4.2.11"
postcss "8.4.31"
styled-jsx "5.1.1"
optionalDependencies:
"@next/swc-darwin-arm64" "14.1.1-canary.54"
"@next/swc-darwin-x64" "14.1.1-canary.54"
"@next/swc-linux-arm64-gnu" "14.1.1-canary.54"
"@next/swc-linux-arm64-musl" "14.1.1-canary.54"
"@next/swc-linux-x64-gnu" "14.1.1-canary.54"
"@next/swc-linux-x64-musl" "14.1.1-canary.54"
"@next/swc-win32-arm64-msvc" "14.1.1-canary.54"
"@next/swc-win32-ia32-msvc" "14.1.1-canary.54"
"@next/swc-win32-x64-msvc" "14.1.1-canary.54"
"@next/swc-darwin-arm64" "14.1.1-canary.56"
"@next/swc-darwin-x64" "14.1.1-canary.56"
"@next/swc-linux-arm64-gnu" "14.1.1-canary.56"
"@next/swc-linux-arm64-musl" "14.1.1-canary.56"
"@next/swc-linux-x64-gnu" "14.1.1-canary.56"
"@next/swc-linux-x64-musl" "14.1.1-canary.56"
"@next/swc-win32-arm64-msvc" "14.1.1-canary.56"
"@next/swc-win32-ia32-msvc" "14.1.1-canary.56"
"@next/swc-win32-x64-msvc" "14.1.1-canary.56"

normalize-path@^3.0.0, normalize-path@~3.0.0:
version "3.0.0"
Expand Down Expand Up @@ -1217,20 +1217,20 @@ queue-microtask@^1.2.2:
resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz"
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==

"[email protected]f0e808e5b-20240214", "react@>= 16.8.0 || 17.x.x || ^18.0.0-0", react@^18.0.0, react@^18.2.0, react@canary:
version "18.3.0-canary-f0e808e5b-20240214"
resolved "https://registry.npmjs.org/react/-/react-18.3.0-canary-f0e808e5b-20240214.tgz"
integrity sha512-LE0h6oDDPUCsl9CXmDyembvCNQTKKQ28HbQku4F7pYW/Pa8DST/YaMOAQSBzNUAS+6eNaoEgSkypQ68ho1iqHw==
"[email protected]2e470a788-20240214", "react@>= 16.8.0 || 17.x.x || ^18.0.0-0", react@^18.0.0, react@^18.2.0, react@canary:
version "18.3.0-canary-2e470a788-20240214"
resolved "https://registry.npmjs.org/react/-/react-18.3.0-canary-2e470a788-20240214.tgz"
integrity sha512-yAKIu2SdFpKjw21QaLzT6hDLCHBBKbSq/28yLraOAUR/y5jXxu6u5CzKU5lRIIy2ZAB7MnO8gjHRH39ssnOkJw==
dependencies:
loose-envify "^1.1.0"

react-dom@^18.0.0, react-dom@^18.2.0, react-dom@canary:
version "18.3.0-canary-f0e808e5b-20240214"
resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.3.0-canary-f0e808e5b-20240214.tgz"
integrity sha512-6oUH75HV23vOblZ49a8Q9hLeaRwjNnwRJWt11oYARwFTmUCuw+Kp/B+jpR5ZCJUPAfBVqpNo/VA4NwVb3VNkkA==
version "18.3.0-canary-2e470a788-20240214"
resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.3.0-canary-2e470a788-20240214.tgz"
integrity sha512-NC6NkyJxgF45vRqqPthcIl3ZPgc6jKH3bzyVG99pWV6DL9RM+y81qaRXm3PK0K96BdwKB+HkIkzKlZe8LYNSFQ==
dependencies:
loose-envify "^1.1.0"
scheduler "0.24.0-canary-f0e808e5b-20240214"
scheduler "0.24.0-canary-2e470a788-20240214"

react-is@^17.0.1:
version "17.0.2"
Expand Down Expand Up @@ -1287,10 +1287,10 @@ run-parallel@^1.1.9:
dependencies:
queue-microtask "^1.2.2"

"[email protected]f0e808e5b-20240214":
version "0.24.0-canary-f0e808e5b-20240214"
resolved "https://registry.npmjs.org/scheduler/-/scheduler-0.24.0-canary-f0e808e5b-20240214.tgz"
integrity sha512-atwW6jzZNABeMiSZqarJDu/Tq5df/ewah//OfAEoddqYzoWZx95PPrDyDvbNjDuDlDLcNBFxcXGvs9l472mE0w==
"[email protected]2e470a788-20240214":
version "0.24.0-canary-2e470a788-20240214"
resolved "https://registry.npmjs.org/scheduler/-/scheduler-0.24.0-canary-2e470a788-20240214.tgz"
integrity sha512-9KARZ5unFpeX2YVL8kWQz4E/HqghewAoI2yhXITKpIVNyM8ZbeIklaUcQpFuVJ39T3M5pOGhMl3Mp9YNXWOsXA==
dependencies:
loose-envify "^1.1.0"

Expand Down
Loading