-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
43 lines (29 loc) · 1.14 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM node AS build
LABEL org.opencontainers.image.description "Dockstat is an OpenSource Docker statistics webservice. It relies on the dockstatapi"
LABEL org.opencontainers.image.source=https://github.com/its4nik/dockstat
LABEL org.opencontainers.image.licenses=MPL-2.0
WORKDIR /build
# Set environment variables for build time
ARG REACT_APP_API_URL
ARG REACT_APP_DEFAULT_THEME
ARG REACT_APP_SECRET
ENV REACT_APP_API_URL=${REACT_APP_API_URL}
ENV REACT_APP_DEFAULT_THEME=${REACT_APP_DEFAULT_THEME}
ENV REACT_APP_SECRET=${REACT_APP_SECRET}
COPY . /build
# Install dependencies and build the React app
RUN npm install --force && \
npm run build && \
chmod +x /build/entrypoint.sh
# Final stage
FROM node:slim
WORKDIR /app
# Copy build artifacts and entrypoint script from the build stage
COPY --from=build /build/build /app/build
COPY --from=build /build/entrypoint.sh /app
COPY --from=build /build/healthcheck.js /app/healthcheck.js
RUN npm install -g serve
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 CMD node /app/healthcheck.js
# Run the entrypoint script
ENTRYPOINT [ "bash", "/app/entrypoint.sh" ]