Skip to content

Commit 93874c6

Browse files
committed
Fix build: switch to nginx alpine, drop entrypoint script entirely
1 parent 57e7ac4 commit 93874c6

4 files changed

Lines changed: 51 additions & 33 deletions

File tree

Dockerfile

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,14 @@ RUN yarn install
1515
ENV GOOGLE_TAGMANAGER_ID="G-2778ZJCYZ4"
1616
RUN yarn build
1717

18-
FROM phusion/passenger-nodejs:3.1.2
19-
COPY --from=build /usr/src /usr/share/initializr/www
20-
RUN chown -R app:app /usr/share/initializr/www
21-
RUN apt-get update && apt-get install -y gettext-base
22-
RUN rm /etc/nginx/sites-enabled/default
23-
RUN rm -f /etc/service/nginx/down
24-
RUN sed -i "s|daemon off;|#daemon off; |g" /etc/nginx/nginx.conf
25-
RUN echo "env INITIALIZR_SERVICE_HOST;" >> /etc/nginx/main.d/default.conf
26-
RUN echo "env INITIALIZR_SERVICE_URI;" >> /etc/nginx/main.d/default.conf
27-
COPY deploy/docker/initializr-web.conf.template /etc/nginx/templates/
28-
COPY deploy/docker/docker-entrypoint.sh ./
29-
RUN chmod +x ./docker-entrypoint.sh
30-
ENTRYPOINT [ "./docker-entrypoint.sh" ]
31-
CMD ["nginx", "-g", "daemon off;"]
18+
FROM nginx:1-alpine
19+
# Copy the build artifacts from the build stage
20+
COPY --from=build /usr/src/public /usr/share/nginx/html
21+
22+
# Copy the nginx configuration template
23+
# nginx:alpine automatically runs envsubst on files in /etc/nginx/templates/
24+
# and outputs them to /etc/nginx/conf.d/
25+
COPY deploy/docker/initializr-web.conf.template /etc/nginx/templates/default.conf.template
3226

33-
# cat /etc/nginx/sites-enabled/initializr.conf
34-
# tail -f /var/log/nginx/access.log
35-
# tail -f /var/log/nginx/error.log
27+
EXPOSE 80
28+
CMD ["nginx", "-g", "daemon off;"]

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,38 @@ Branding differences include reference URLs, color schemes, and logos.
1010
Domain metadata includes metadata differences such as "Java version" vs ".NET version" and "Spring Boot" vs "Steeltoe."
1111
A list of files that are known to diverge from Spring is available [here](./Upstream.md)
1212

13+
## Docker
14+
15+
### Building the Image
16+
17+
You can build the Docker image locally using the following command:
18+
19+
```bash
20+
docker build -t initializr-web .
21+
```
22+
23+
### Running the Image
24+
25+
To run the image locally, you need to provide the `INITIALIZR_SERVICE_HOST` and `INITIALIZR_SERVICE_URI` environment variables. These point to the backend API service.
26+
27+
**Bash:**
28+
```bash
29+
docker run -p 8080:80 \
30+
-e INITIALIZR_SERVICE_HOST="start.steeltoe.io" \
31+
-e INITIALIZR_SERVICE_URI="https://start.steeltoe.io/api" \
32+
initializr-web
33+
```
34+
35+
**PowerShell:**
36+
```powershell
37+
docker run -p 8080:80 `
38+
-e INITIALIZR_SERVICE_HOST="start.steeltoe.io" `
39+
-e INITIALIZR_SERVICE_URI="https://start.steeltoe.io/api" `
40+
initializr-web
41+
```
42+
43+
The application will be accessible at `http://localhost:8080`.
44+
1345
## Deploying
1446

1547
There are two endpoints that the Web UI uses to 1) populate its UI, and 2) generate projects:

deploy/docker/docker-entrypoint.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

deploy/docker/initializr-web.conf.template

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
server {
22
listen 80;
3-
root /usr/share/initializr/www/public;
4-
passenger_enabled on;
5-
passenger_user app;
6-
passenger_app_type node;
7-
passenger_startup_file src/App.js;
3+
root /usr/share/nginx/html;
4+
index index.html;
5+
6+
location / {
7+
try_files $uri $uri/ /index.html;
8+
}
89

910
location /api {
10-
proxy_ssl_protocols TLSv1.2;
11+
proxy_ssl_protocols TLSv1.2;
12+
proxy_ssl_server_name on;
13+
proxy_ssl_name $INITIALIZR_SERVICE_HOST;
1114
proxy_pass $INITIALIZR_SERVICE_URI;
1215
proxy_set_header Host $INITIALIZR_SERVICE_HOST;
1316
proxy_set_header Connection keep-alive;
@@ -17,5 +20,3 @@ server {
1720
proxy_set_header X-Forwarded-Host $server_name;
1821
}
1922
}
20-
21-
# vim: ft=nginx

0 commit comments

Comments
 (0)