Skip to content

Commit 680f469

Browse files
Sathvik-Allundi-IBMreggeenr
authored andcommitted
address review comments
Signed-off-by: sathvik-allundi007 <[email protected]>
1 parent 9dff016 commit 680f469

File tree

4 files changed

+21
-41
lines changed

4 files changed

+21
-41
lines changed

fotobox/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# IBM Fotobox
22

3-
This is the IBM Fotobox. Deploy your own Fotobox straight to the IBM Cloud Access it directly from any device with browser and camera. Take Pictures and view them all from your device.
3+
This is the IBM Fotobox. Deploy your own Fotobox straight to the IBM Cloud access it directly from any device with browser and camera. Take pictures and view them all from your device.
44

55
The solution is based on:
6-
- The frontend a Svelte Single Page Application running as a App on Code Engine able to scale to 0 in oder to optimise cost.
7-
- The Upload function which generates a thumbnail of the image and stores both in COS written in Python and running as a Function on Code Engine.
8-
- The Downloader a Go programm designed to serve the images stored in COS or download all at one go if you are the operator of the fotobox.
9-
- All Images are stored in IBM Cloud Object Storage to ensure security and scalability.
6+
- The "frontend" a Svelte Single Page Application(SPA) running as a Code Engine app, that is able to scale to 0 in oder to optimise cost.
7+
- The "upload" function which generates a thumbnail of the image and stores both in COS written in Python and running as a Code Engine function.
8+
- The "downloader" a Go program designed to serve the images stored in COS or download all at one go if you are the operator of the fotobox.
9+
- All images are stored in IBM Cloud Object Storage to ensure security and scalability.
1010

1111
## Setup
1212

@@ -21,28 +21,28 @@ already installed) and make sure you have a IBM Cloud Account:
2121

2222
## Automated Setup
2323

24-
In order to make the setup as convinent as possible we probide you with a setupscript which uses teraform and the IBM Cloud CLI
24+
In order to make the setup as convenient as possible we probide you with a setup script which uses terraform and the IBM Cloud CLI
2525

26-
1. configure the `terraform.auto.tfvars` with your apikey and your resource group id
26+
1. Configure the `terraform.auto.tfvars` with your apikey and your resource group id
2727

28-
2. Run the `setup.sh <apikey>`and it will deploy all the required components and done
28+
2. Run the `setup.sh <apikey>` and it will deploy all the required components and done
2929

3030
## Manual setup
3131

32-
1. Setup COS with cos bucket this can be done over the UI or using the CLI
32+
1. Setup a COS instance and a COS bucket this can be done over the UI or using the CLI
3333
note dont the bucket name and API credentials
3434

35-
2. Deploy the Upload Function using the CLI
35+
2. Deploy the "upload" function using the CLI
3636
```bash
3737
ibmcloud ce fn create --name fotobox-cos-upload --runtime python --build-source upload-function
3838
```
3939

40-
3. Deploy the Download App using the CLI
40+
3. Deploy the "download" app using the CLI
4141
```bash
4242
ibmcloud ce app create --name fotobox-get-pics --build-dockerfile Dockerfile --build-source download-app
4343
```
4444

45-
4. Create a Secret map containing the following values. use the following command to create the password
45+
4. Create a secret map containing the following values. Use the following command to create the password
4646
```bash
4747
echo -n "password" | sha256
4848
5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
@@ -72,4 +72,4 @@ export const downloadURL = "<replace with download app url"
7272
ibmcloud ce app create --name fotobox-frontend --build-dockerfile Dockerfile --build-source frontend-app
7373
```
7474

75-
Now the Fotobox should be deployed and usable
75+
Now the Fotobox should be deployed and usable

fotobox/cos-setup/main.tf

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ locals {
1818
resource_credentials =jsondecode(ibm_resource_key.cos-credentials.credentials_json)
1919
}
2020

21-
# create cos-but to upload
21+
# create cos-but to upload
2222
resource "ibm_cos_bucket" "cos_bucket" {
2323
bucket_name = "fotobox-bucket"
2424
resource_instance_id = ibm_resource_instance.cos_instance.id
@@ -39,23 +39,12 @@ resource "ibm_code_engine_secret" "fotobox-secret" {
3939
project_id = ibm_code_engine_project.ce-fotobox-project.id
4040
name = "fotobox-secret"
4141
format = "generic"
42-
42+
4343
data = {
4444
"apikey" = local.resource_credentials.apikey
4545
}
4646
}
4747

48-
#resource "ibm_code_engine_secret" "registry_secret" {
49-
# project_id = ibm_code_engine_project.ce-fotobox-project.id
50-
# name = "container-registry-secret"
51-
# format = "registry"
52-
# data = {
53-
# "username" = "iamapikey" # Use 'iamapikey' as username for IBM Cloud
54-
# "password" = var.icr_secret
55-
# "server" = "us.icr.io" # Change if using a different registry
56-
# }
57-
#}
58-
5948
# create config map in project
6049

6150
resource "ibm_code_engine_config_map" "fotobox-config" {
@@ -69,4 +58,4 @@ resource "ibm_code_engine_config_map" "fotobox-config" {
6958
"region" = ibm_cos_bucket.cos_bucket.region_location
7059
"resource_instance_id" = local.resource_credentials.resource_instance_id
7160
}
72-
}
61+
}

fotobox/download-app/Dockerfile

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
FROM golang:1.23
2-
3-
4-
# Build the application from source
5-
FROM --platform=linux/amd64 golang:1.23 AS build-stage
1+
FROM registry.access.redhat.com/ubi9/go-toolset:1.24 AS build-stage
62

73
WORKDIR /app
84

@@ -15,17 +11,12 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /api
1511

1612

1713
# Deploy the application binary into a lean image
18-
FROM --platform=linux/amd64 alpine
19-
20-
14+
FROM gcr.io/distroless/static:latest
2115

2216
WORKDIR /
2317

24-
RUN mkdir images
2518
COPY --from=build-stage /api /api
2619

27-
2820
EXPOSE 8080
2921

30-
31-
ENTRYPOINT ["/api"]
22+
ENTRYPOINT ["/api"]

fotobox/frontend-app/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=linux/amd64 node:22 as build
1+
FROM egistry.access.redhat.com/ubi9/nodejs-22:latest as build
22

33
WORKDIR /app
44

@@ -7,7 +7,7 @@ COPY . .
77
RUN npm install && npm run build
88

99

10-
FROM --platform=linux/amd64 node:22
10+
FROM gcr.io/distroless/nodejs22
1111

1212
WORKDIR /app
1313

0 commit comments

Comments
 (0)