Skip to content

Commit fdcd7a0

Browse files
committed
chore: wip
1 parent 01742a2 commit fdcd7a0

File tree

8 files changed

+28
-20
lines changed

8 files changed

+28
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ It’s incredibly easy to get started with this framework. Simply run the follow
3535
```bash
3636
curl -Ssf stacksjs.org/install | sh # wip
3737

38-
# alternatively, if Bun >= v1.1.20 is installed already,
38+
# alternatively, if Bun >= v1.1.21 is installed already,
3939
# you may also get started via:
4040
bunx stacks new my-project
4141
```

bun.lockb

36.7 KB
Binary file not shown.

config/cloud.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
prefix: env.API_PREFIX || 'api',
2222
// version: 'v1',
2323
description: 'My awesome Stacks API',
24-
deploy: true,
24+
deploy: false,
2525
memorySize: 512,
2626
prewarm: 10,
2727
timeout: 30,

pkgx.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# https://stacksjs.org/docs/dependency-management
1010

1111
dependencies:
12-
bun.sh: ^1.1.20
12+
bun.sh: ^1.1.21
1313
aws.amazon.com/cli: ^2.17.13
1414
dns.lookup.dog: ^0.1.0
1515
info-zip.org/zip: ^3.0

storage/framework/cloud/Dockerfile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM oven/bun:1 AS base
55
WORKDIR /usr/src/app
66

77
# Install curl - I wonder if there is a better way to do this, because it is only needed for the healthcheck — is wget installed by default?
8-
RUN apt-get update && apt-get install -y curl
8+
RUN apt-get update && apt-get install -y curl rsync
99

1010
# install dependencies into temp directory
1111
# this will cache them and speed up future builds
@@ -41,15 +41,20 @@ COPY . .
4141
# copy production dependencies and source code into final image
4242
FROM base AS release
4343
COPY --from=install /temp/prod/node_modules ./node_modules
44-
COPY --from=prerelease /usr/src/app/app ./app
45-
COPY --from=prerelease /usr/src/app/config ./config
46-
COPY --from=prerelease /usr/src/app/core ./core
47-
COPY --from=prerelease /usr/src/app/docs ./docs
48-
COPY --from=prerelease /usr/src/app/routes ./routes
49-
COPY --from=prerelease /usr/src/app/storage ./storage
50-
COPY --from=prerelease /usr/src/app/index.ts ./index.ts
51-
COPY --from=prerelease /usr/src/app/tsconfig.json ./tsconfig.json
52-
COPY --from=prerelease /usr/src/app/package.json ./package.json
44+
45+
# Use rsync to copy files while respecting .gitignore and .dockerignore
46+
# https://unix.stackexchange.com/questions/168561/rsync-folder-while-exclude-froming-gitignore-files-at-different-depths
47+
RUN rsync --filter='dir-merge,-n /.gitignore' /usr/src/app/ /usr/src/app_release/
48+
49+
COPY --from=prerelease /usr/src/app_release/app ./app
50+
COPY --from=prerelease /usr/src/app_release/config ./config
51+
COPY --from=prerelease /usr/src/app_release/core ./core
52+
COPY --from=prerelease /usr/src/app_release/docs ./docs
53+
COPY --from=prerelease /usr/src/app_release/routes ./routes
54+
COPY --from=prerelease /usr/src/app_release/storage ./storage
55+
COPY --from=prerelease /usr/src/app_release/index.ts ./index.ts
56+
COPY --from=prerelease /usr/src/app_release/tsconfig.json ./tsconfig.json
57+
COPY --from=prerelease /usr/src/app_release/package.json ./package.json
5358

5459
# Add volume for logs
5560
VOLUME ["/mnt/efs"]

storage/framework/cloud/build.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import process from 'node:process'
22
import { log, runCommand } from '@stacksjs/cli'
3-
import { app } from '@stacksjs/config'
3+
import { app, cloud as cloudConfig } from '@stacksjs/config'
44
import { frameworkPath, projectPath } from '@stacksjs/path'
55
import { hasFiles } from '@stacksjs/storage'
6+
import { cloud } from '../core/buddy/src'
67

78
// import { slug } from '@stacksjs/strings'
89

@@ -55,7 +56,8 @@ async function buildServer() {
5556

5657
async function main() {
5758
useCustomOrDefaultServerConfig()
58-
await buildServer()
59+
if (cloudConfig.api?.deploy)
60+
await buildServer()
5961
}
6062

6163
main().catch((error) => {

storage/framework/cloud/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"files": ["README.md", "dist", "src"],
4040
"scripts": {
4141
"bootstrap": "bunx cdk bootstrap",
42-
"deploy": "cd .. && bun run build && cd ./docs && bun run build && cd ../core/cloud && bunx cdk deploy --require-approval never",
42+
"deploy": "cd .. && bun run build && cd ./docs && bun run build && cd ../cloud && bunx cdk deploy --require-approval never",
4343
"dev": "./dev local",
4444
"dev:container": "docker run -d -p 3000:3000 stacks",
4545
"build": "bun build.ts"

storage/framework/core/cloud/src/cloud/compute.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ export class ComputeStack {
5050
},
5151
})
5252

53-
const assetImage = new ecr_assets.DockerImageAsset(scope, 'DockerImageAsset', {
54-
directory: p.frameworkPath('cloud'),
55-
})
53+
// const assetImage = new ecr_assets.DockerImageAsset(scope, 'DockerImageAsset', {
54+
// directory: p.frameworkPath('cloud'),
55+
// })
5656

5757
const container = this.taskDefinition.addContainer('WebServerContainer', {
5858
containerName: `${props.appName}-${props.appEnv}-api`,
59-
image: ecs.ContainerImage.fromDockerImageAsset(assetImage),
59+
// image: ecs.ContainerImage.fromDockerImageAsset(assetImage),
60+
image: ecs.ContainerImage.fromAsset(p.frameworkPath('cloud')),
6061
logging: new ecs.AwsLogDriver({
6162
streamPrefix: `${props.appName}-${props.appEnv}-web-server-logs`,
6263
logGroup: new LogGroup(scope, 'StacksApiLogs', {

0 commit comments

Comments
 (0)