Skip to content

Commit 6220704

Browse files
committed
Add image option
1 parent f449666 commit 6220704

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ jobs:
5757
env:
5858
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
5959
run: |
60-
pip install localstack localstack
60+
pip install localstack
6161
docker pull localstack/localstack-pro
62+
localstack auth set-token $LOCALSTACK_AUTH_TOKEN
6263
localstack start -d
6364
localstack wait -t 30
6465

src/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ const TYPESCRIPT_PLUGIN_BUILD_DIR_BUILTIN_ESBUILD = '.serverless/build'; //TODO
2727
// Default AWS endpoint URL
2828
const DEFAULT_AWS_ENDPOINT_URL = 'http://localhost:4566';
2929

30+
// Default LocalStack Image
31+
const LOCALSTACK_PRO_IMAGE = 'localstack/localstack-pro';
32+
3033
// Cache hostname to avoid unnecessary connection checks
3134
let resolvedHostname = undefined;
3235

@@ -425,6 +428,10 @@ class LocalstackPlugin {
425428
shouldRunDockerSudo() {
426429
return (this.config.docker || {}).sudo;
427430
}
431+
432+
getLocalstackImage(){
433+
return (this.config.image || process.env.IMAGE_NAME || LOCALSTACK_PRO_IMAGE);
434+
}
428435

429436
getStageVariable() {
430437
const customConfig = this.serverless.service.custom || {};
@@ -538,6 +545,10 @@ class LocalstackPlugin {
538545
if (this.shouldRunDockerSudo()) {
539546
env.DOCKER_CMD = 'sudo docker';
540547
}
548+
549+
550+
env.IMAGE_NAME = this.getLocalstackImage();
551+
541552
const options = { env: env, maxBuffer };
542553
return exec('localstack start -d', options)
543554
.then(getContainer)

0 commit comments

Comments
 (0)