-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(python): use
sim.Container
(#261)
Use the `sim.Container` to show containers logs. Also use docker image instead of local python to build the python dependencies.
- Loading branch information
Showing
13 changed files
with
200 additions
and
421 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM public.ecr.aws/lambda/python:3.12 | ||
|
||
COPY requirements.txt /app/requirements.txt | ||
|
||
RUN pip install -r /app/requirements.txt |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 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,16 +1,30 @@ | ||
const { App } = require("@winglang/sdk/lib/core"); | ||
const { Function: SimFunction } = require("@winglang/sdk/lib/target-sim/function.js"); | ||
|
||
module.exports.handleSimInflight = (inflight, props) => { | ||
for (let e in props.env) { | ||
inflight.inner.service.addEnvironment(e, props.env[e]); | ||
} | ||
module.exports.Function = class Function extends SimFunction { | ||
constructor( | ||
scope, | ||
id, | ||
inflight, | ||
props = {}, | ||
pythonInflight, | ||
) { | ||
super(scope, id, inflight, props); | ||
|
||
this.pythonInflight = pythonInflight; | ||
|
||
if (!App.of(inflight).isTestEnvironment) { | ||
for (let key of ["AWS_REGION", "AWS_DEFAULT_REGION", "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"]) { | ||
let value = process.env[key]; | ||
if (value) { | ||
inflight.inner.service.addEnvironment(key, value); | ||
if (!App.of(this).isTestEnvironment) { | ||
for (let key of ["AWS_REGION", "AWS_DEFAULT_REGION", "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"]) { | ||
let value = process.env[key]; | ||
if (value) { | ||
this.addEnvironment(key, value); | ||
} | ||
} | ||
} | ||
} | ||
|
||
_preSynthesize() { | ||
this.pythonInflight.inner.preLift(this); | ||
return super._preSynthesize(); | ||
} | ||
} |
Oops, something went wrong.