Skip to content
This repository was archived by the owner on Aug 21, 2021. It is now read-only.

Commit af4f73f

Browse files
committed
perform code build inside docker container
1 parent 08d870c commit af4f73f

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Dockerfile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,30 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
FROM node:8-alpine as nodebuilder
16+
17+
COPY . src/
18+
WORKDIR /src
19+
RUN npm install
20+
RUN npm run build-prod
21+
22+
#########################
23+
1524
FROM alpine:latest
1625

1726
RUN mkdir -p /usr/share/nginx/html
18-
COPY /dist /usr/share/nginx/html
27+
COPY --from=nodebuilder /src/dist /usr/share/nginx/html
1928
RUN apk add --update curl && \
2029
curl --silent --show-error --fail --location \
2130
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
2231
"https://caddyserver.com/download/linux/amd64?license=personal" \
2332
| tar --no-same-owner -C /usr/bin/ -xz caddy && \
2433
chmod 0755 /usr/bin/caddy && \
2534
/usr/bin/caddy -version && \
26-
apk del curl && \
35+
apk del curl && \
2736
rm -rf /root/.cache /root/.config /root/.local /root/.ash_history \
28-
/usr/share/man /var/cache/apk/*
29-
37+
/usr/share/man /var/cache/apk/*
38+
3039
EXPOSE 80
3140
CMD ["/usr/bin/caddy", "-root", "/usr/share/nginx/html", "-port", "80"]
3241
VOLUME ["/usr/share/nginx/html"]

0 commit comments

Comments
 (0)