forked from mongo-express/mongo-express
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (36 loc) · 1.73 KB
/
Copy pathDockerfile
File metadata and controls
46 lines (36 loc) · 1.73 KB
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
44
45
46
FROM node:18-alpine3.16 AS build
# Build argument for enabling OIDC support
ARG ENABLE_OIDC=false
WORKDIR /dockerbuild
COPY . .
RUN if [ "$ENABLE_OIDC" = "true" ]; then \
apk add --no-cache jq \
&& jq '.dependencies["express-openid-connect"] = "^2.19.2" | del(.peerDependencies["express-openid-connect"]) | del(.peerDependenciesMeta["express-openid-connect"])' package.json > package.tmp.json \
&& mv package.tmp.json package.json; \
fi \
&& yarn install \
&& yarn build \
&& rm -rf /dockerbuild/lib/scripts
FROM node:18-alpine3.16
# "localhost" doesn't mean much in a container, so we adjust our default to the common service name "mongo" instead
# (and make sure the server listens outside the container, since "localhost" inside the container is usually difficult to access)
ENV ME_CONFIG_MONGODB_URL="mongodb://mongo:27017"
ENV ME_CONFIG_MONGODB_ENABLE_ADMIN="true"
ENV VCAP_APP_HOST="0.0.0.0"
WORKDIR /opt/mongo-express
COPY --from=build /dockerbuild/build /opt/mongo-express/build/
COPY --from=build /dockerbuild/public /opt/mongo-express/public/
COPY --from=build /dockerbuild/lib /opt/mongo-express/lib/
COPY --from=build /dockerbuild/app.js /opt/mongo-express/
COPY --from=build /dockerbuild/config.default.js /opt/mongo-express/
COPY --from=build /dockerbuild/*.json /opt/mongo-express/
COPY --from=build /dockerbuild/.yarn /opt/mongo-express/.yarn/
COPY --from=build /dockerbuild/yarn.lock /opt/mongo-express/
COPY --from=build /dockerbuild/.yarnrc.yml /opt/mongo-express/
COPY --from=build /dockerbuild/.npmignore /opt/mongo-express/
RUN apk -U add --no-cache \
bash=5.1.16-r2 \
tini=0.19.0-r0 \
&& yarn workspaces focus --production
EXPOSE 8081
CMD ["/sbin/tini", "--", "yarn", "start"]