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

feat(serverless): release serverless container #873

Merged
merged 27 commits into from
May 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a8d0e4f
feat: improve local development setup
anbraten May 15, 2023
721228e
feat(serverless): add container image
anbraten May 15, 2023
1e925ac
add changeset
anbraten May 15, 2023
220743d
Merge branch 'main' into release-serverless
anbraten May 15, 2023
33f452e
Revert "feat: improve local development setup"
anbraten May 15, 2023
5c1ff38
Merge branch 'release-serverless' of github.com:anbraten/lagon into r…
anbraten May 15, 2023
1e20508
Merge branch 'main' into release-serverless
anbraten May 15, 2023
4245c97
fix build
anbraten May 15, 2023
5ac5478
test
anbraten May 15, 2023
c0e52e8
Merge branch 'main' into release-serverless
anbraten May 15, 2023
78efd04
hard code branch
anbraten May 15, 2023
2f0cba8
Merge branch 'release-serverless' of github.com:anbraten/lagon into r…
anbraten May 15, 2023
aaffdd1
fix conditions
anbraten May 15, 2023
436159f
Merge branch 'main' into release-serverless
anbraten May 16, 2023
499968a
Update .github/workflows/container.yml
anbraten May 18, 2023
b2a92c8
Merge branch 'main' into release-serverless
anbraten May 18, 2023
b54faec
push image on tag
anbraten May 19, 2023
f11f464
use docker actions and add arm64 platform
anbraten May 20, 2023
88c2141
adjust changeset config
anbraten May 20, 2023
561d31d
remove unnecessary build args
anbraten May 20, 2023
a205d29
add docker hub
anbraten May 27, 2023
9c37969
Merge branch 'main' into release-serverless
anbraten May 27, 2023
3820bd5
fix image tagging
anbraten May 27, 2023
1d927e0
Merge branch 'release-serverless' of github.com:anbraten/lagon into r…
anbraten May 27, 2023
835a1dd
fix config
anbraten May 27, 2023
c92bb3b
improve workflow
anbraten May 27, 2023
ad88bea
fix check
anbraten May 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@
}
],
"commit": false,
"fixed": [
[
"@lagon/runtime",
"@lagon/js-runtime"
]
],
"fixed": [["@lagon/runtime", "@lagon/js-runtime"]],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch"
}
"updateInternalDependencies": "patch",
"privatePackages": { "version": true, "tag": true }
}
5 changes: 5 additions & 0 deletions .changeset/flat-rabbits-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lagon/serverless': minor
---

Release container image
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dist/
.env
.eslintcache
crates/serverless/deployments/
docker/
70 changes: 70 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Container

on:
push:
branches:
- main
tags:
- '@lagon/serverless@*'
pull_request:

env:
DOCKER_HUB_USER: lagonapp

jobs:
create-container-image:
name: Create "${{matrix.image}}" container image
runs-on: ubuntu-latest
strategy:
matrix:
# image: [serverless, dashboard]
image: [serverless]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.DOCKER_HUB_USER }}/${{matrix.image}}
ghcr.io/${{ github.repository_owner }}/${{matrix.image}}
tags: |
type=ref,event=tag,prefix=@lagon/${{matrix.image}}@
type=ref,event=pr
type=raw,value=next,enable={{is_default_branch}}

- name: Login to ghcr.io registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ env.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
if: "!startsWith(github.ref, 'refs/tags/') || contains(github.ref, matrix.image)" # only execute if not tag or tag with specific matrix image
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: docker/Dockerfile.${{matrix.image}}
platforms: ${{ github.event_name == 'pull_request' && 'linux/amd64' || 'linux/amd64,linux/arm64' }} # only build for amd64 on PRs to speed up CI job
2 changes: 1 addition & 1 deletion docker/Dockerfile → docker/Dockerfile.serverless
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
COPY --from=js-runtime /app/dist/index.js /app/crates/js-runtime/dist
COPY --from=js-runtime /app/dist/index.js /app/crates/runtime_isolate/runtime.js
RUN cargo build --release --bin lagon-serverless

FROM debian:bullseye-slim AS runtime
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "turbo build --continue --filter=!@lagon/example-*",
"lint": "turbo lint --continue",
"typecheck": "turbo typecheck --continue",
"docker:build": "docker build -t lagon/serverless -f docker/Dockerfile .",
"docker:build": "docker build -t lagon/serverless -f docker/Dockerfile.serverless .",
"docker:start": "docker run --rm -p 4000:4000 --env-file crates/serverless/.env lagon/serverless",
"release": "pnpm build --filter=@lagon/astro --filter=@lagon/remix && pnpm changeset publish"
},
Expand Down