Commit c2ab334 1 parent 82662d6 commit c2ab334 Copy full SHA for c2ab334
File tree 6 files changed +69
-22
lines changed
6 files changed +69
-22
lines changed Original file line number Diff line number Diff line change @@ -15,3 +15,14 @@ node_modules
15
15
.prettierrc
16
16
README.md
17
17
* .tsbuildinfo
18
+
19
+
20
+ .DS_Store
21
+ .env
22
+ .example.env
23
+ .github
24
+ .gitmodules
25
+ .idea
26
+ .octopus
27
+ azure-mock
28
+ node_modules
Original file line number Diff line number Diff line change 1
- # BUILDER IMAGE
2
- FROM node:23.5-alpine AS builder
3
-
4
- WORKDIR /service
5
-
6
- COPY . .
7
-
8
- RUN npm ci --no-scripts
9
-
10
- RUN npm run ng:build
11
- RUN npm run server:build
12
-
13
- # PRODUCTION IMAGE
1
+ # Single-Stage Dockerfile
14
2
FROM node:23.5-alpine
15
3
16
- # Set build arguments
4
+ # Set environment arguments and variables
17
5
ARG BUILD_DATE
18
6
ARG COMMIT_ID
19
7
ARG VERSION
20
8
21
- # Set environment variables
22
- ENV BUILD_DATE=$BUILD_DATE
23
- ENV COMMIT_ID=$COMMIT_ID
24
- ENV VERSION=$VERSION
9
+ # Environment variables
10
+ ENV BUILD_DATE=$BUILD_DATE \
11
+ COMMIT_ID=$COMMIT_ID \
12
+ VERSION=$VERSION
25
13
26
14
WORKDIR /service
27
15
16
+ # Create a non-root user for security
28
17
RUN addgroup --system --gid 1001 nodejs && \
29
18
adduser --system --uid 1001 nodejs
30
19
31
- COPY --chown=nodejs:nodejs --from=builder /service/dist dist
32
- COPY --chown=nodejs:nodejs --from=builder /service/node_modules node_modules
20
+ # Copy all necessary files into the image
21
+ COPY . .
22
+
23
+ # Change ownership of the service folder and all copied files to the nodejs user
24
+ RUN chown -R nodejs:nodejs /service
25
+
26
+ # Install dependencies
27
+ RUN npm ci --no-scripts
33
28
29
+ # Switch to non-root user
34
30
USER nodejs
35
31
32
+ # Expose port for the server
36
33
EXPOSE 3000
37
34
38
- CMD node dist/server/server.js
35
+ # Start the application via start.sh script
36
+ CMD ["sh" , "./start.sh" ]
Original file line number Diff line number Diff line change 1
1
config :
2
2
ahb-tabellen:ahbBlobContainerName : ahb-tables
3
3
ahb-tabellen:appPath : app
4
+ ahb-tabellen:bedingungsbaumBaseUrl : https://bedingungsbaum.stage.hochfrequenz.de
4
5
ahb-tabellen:containerPort : " 80"
5
6
ahb-tabellen:cpu : " 1"
7
+ ahb-tabellen:environment : stage
6
8
ahb-tabellen:formatVersionContainerName : format-versions
7
9
ahb-tabellen:ghcr_token :
8
10
secure : AAABAEg7fEk2P91sxA8mlsQ5AueGPcKpU5H8jCLGvH82HsWD1NkdQLT69wDwMfdI7Nc+jSdwJC4Wx/ym4m3HUMGxgeK9RJt0
9
11
ahb-tabellen:imageName : ghcr.io/hochfrequenz/ahbesser
10
12
ahb-tabellen:imageTag : v0.0.22
11
13
ahb-tabellen:memory : " 2"
12
- ahb-tabellen:bedingungsbaumBaseUrl : https://bedingungsbaum.stage.hochfrequenz.de
13
14
azure-native:location : germanywestcentral
14
15
pulumi:template : container-azure-python
Original file line number Diff line number Diff line change
1
+ config :
2
+ ahb-tabellen:ahbBlobContainerName : ahb-tables
3
+ ahb-tabellen:appPath : app
4
+ ahb-tabellen:bedingungsbaumBaseUrl : https://bedingungsbaum.hochfrequenz.de
5
+ ahb-tabellen:containerPort : " 80"
6
+ ahb-tabellen:cpu : " 1"
7
+ ahb-tabellen:environment : production
8
+ ahb-tabellen:formatVersionContainerName : format-versions
9
+ ahb-tabellen:ghcr_token :
10
+ secure : AAABAKDpxgOPRYBk2KIdX7mlihB3y/nJDFZQsK2/2Mf88W8XnEeC4JbZSsDwPfvq0vZjnHa/x3iU6Kt2V1ww8jO3YiXKAswf
11
+ ahb-tabellen:imageName : ghcr.io/hochfrequenz/ahbesser
12
+ ahb-tabellen:imageTag : v0.0.22
13
+ ahb-tabellen:location : germanywestcentral
14
+ ahb-tabellen:memory : " 2"
15
+ azure-native:location : germanywestcentral
16
+ pulumi:template : container-azure-python
Original file line number Diff line number Diff line change 29
29
bedingungsbaum_base_url = config .get ("bedingungsbaumBaseUrl" )
30
30
assert bedingungsbaum_base_url , "bedingungsbaumBaseUrl must be set"
31
31
32
+ environment = config .get ("environment" )
33
+ assert environment , "environment must be set"
34
+
32
35
cpu = config .get_int ("cpu" , 1 )
33
36
memory = config .get_int ("memory" , 2 )
34
37
112
115
azure_native .web .NameValuePairArgs (
113
116
name = "BEDINGUNGSBAUM_BASE_URL" , value = bedingungsbaum_base_url
114
117
),
118
+ azure_native .web .NameValuePairArgs (name = "ENVIRONMENT" , value = environment ),
115
119
],
116
120
linux_fx_version = f"DOCKER|{ image_name_with_tag } " ,
117
121
),
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # Exit immediately if a command exits with a non-zero status
4
+ set -e
5
+
6
+ echo " Starting application setup with environment: $ENVIRONMENT "
7
+
8
+ # Build the Angular application using local Angular CLI
9
+ echo " Building Angular application..."
10
+ npm run ng:build --configuration=$ENVIRONMENT
11
+
12
+ # Build the Express server
13
+ echo " Building Express server..."
14
+ npm run server:build
15
+
16
+ # Start the server
17
+ node dist/server/server.js
You can’t perform that action at this time.
0 commit comments