Skip to content

Commit ba41bf2

Browse files
refactor: clean up deployment scripts and use environment variables for docker image tags
1 parent c48f4dd commit ba41bf2

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

deployment-dapp/src/config/config.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { readFileSync } from 'fs';
21

32
//hosting url
43
export const HOST = 'https://bellecour.iex.ec';
@@ -17,16 +16,9 @@ export const APP_TAG = ['tee', 'scone'];
1716
export const WEB3_MAIL_ENS_NAME_DEV = 'web3mail-dev.apps.iexec.eth';
1817
export const WEB3_MAIL_ENS_NAME_PROD = 'web3mail.apps.iexec.eth';
1918

20-
//scone image
21-
const SCONIFIER_VERSION = '5.7.5-v12';
22-
const dappVersion = JSON.parse(
23-
readFileSync('../dapp/package.json', 'utf-8')
24-
).version;
2519

2620
export const DOCKER_IMAGE_NAMESPACE = 'iexechub';
2721
export const DOCKER_IMAGE_REPOSITORY = 'web3mail-dapp';
28-
export const DOCKER_IMAGE_PROD_TAG = `${dappVersion}-sconify-${SCONIFIER_VERSION}-production`;
29-
export const DOCKER_IMAGE_DEV_TAG = `dev-${process.env.GITHUB_SHA}-sconify-${SCONIFIER_VERSION}-production`;
3022

3123
//GitHub Actions environment variables
3224
export const GITHUB_DEPLOY_ENVIRONMENT =

deployment-dapp/src/deployScript.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ const main = async () => {
3939

4040
const iexec = getIExec(privateKey);
4141

42-
let dockerImageTag;
43-
if (deployEnvironment === GITHUB_DEPLOY_TO_DEV) {
44-
dockerImageTag = DOCKER_IMAGE_DEV_TAG;
45-
} else if (deployEnvironment === GITHUB_DEPLOY_TO_PROD) {
46-
dockerImageTag = DOCKER_IMAGE_PROD_TAG;
42+
const dockerImageTag = deployEnvironment === GITHUB_DEPLOY_TO_DEV
43+
? DOCKER_IMAGE_DEV_TAG
44+
: DOCKER_IMAGE_PROD_TAG;
45+
46+
if (!dockerImageTag) {
47+
throw Error(`Missing docker image tag for environment ${deployEnvironment}`);
4748
}
4849

4950
//deploy app

0 commit comments

Comments
 (0)