Skip to content

Commit d42e5ea

Browse files
authored
Made container build static web app on start-up. (#47)
1 parent 73448ec commit d42e5ea

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ FROM node:slim
44
# Define default values for environment variables
55
ARG APP_TITLE="STAC Manager"
66
ARG APP_DESCRIPTION="A web application for managing STAC catalogs"
7-
ARG REACT_APP_STAC_API=http://localhost:80
8-
ARG PUBLIC_URL=/
7+
ARG REACT_APP_STAC_API="https://earth-search.aws.element84.com/v0"
98

109
ENV APP_TITLE=${APP_TITLE}
1110
ENV APP_DESCRIPTION=${APP_DESCRIPTION}
1211
ENV REACT_APP_STAC_API=${REACT_APP_STAC_API}
13-
ENV PUBLIC_URL=${PUBLIC_URL}
12+
ENV PUBLIC_URL="http://127.0.0.1:8080"
1413

1514
# Set the working directory
1615
WORKDIR /app
@@ -22,8 +21,14 @@ COPY . .
2221
RUN npm i
2322
RUN npm i -g http-server
2423

25-
RUN npm run all:build
24+
25+
# Create a start script that respects runtime environment variables
26+
RUN echo '#!/bin/sh\n\
27+
npm run all:build\n\
28+
http-server -p 80 packages/client/dist' > /app/start.sh
29+
30+
RUN chmod +x /app/start.sh
2631

2732
EXPOSE 80
2833

29-
ENTRYPOINT ["http-server", "-p", "80", "packages/client/dist"]
34+
ENTRYPOINT ["/app/start.sh"]

0 commit comments

Comments
 (0)