8000 add post-build cleanup in the Docker container · github4f/reaction@1a3dc9b · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a3dc9b

Browse files
committed
add post-build cleanup in the Docker container
1 parent bfa33ab commit 1a3dc9b

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,14 @@ RUN chmod +x /usr/bin/entrypoint.sh
9696
COPY bin/docker/build-meteor.sh /usr/bin/build-meteor.sh
9797
RUN chmod +x /usr/bin/build-meteor.sh
9898

99+
COPY bin/docker/cleanup.sh /usr/bin/cleanup.sh
100+
RUN chmod +x /usr/bin/cleanup.sh
101+
99102
# Make sure we have a directory for the application
100103
RUN mkdir -p /var/www
101104
RUN chown -R www-data:www-data /var/www
102105

103106
# add app to /usr/src
104-
VOLUME ["/usr/src/meteor"]
105107
VOLUME ["/data/db"]
106108
COPY . /usr/src/meteor
107109
WORKDIR /usr/src/meteor/
@@ -116,6 +118,11 @@ WORKDIR /usr/src/meteor/
116118
#
117119
RUN bash /usr/bin/build-meteor.sh
118120

121+
# cleanup
122+
RUN apt-get autoremove -y
123+
RUN npm cache clear
124+
RUN bash /usr/bin/cleanup.sh
125+
119126
# switch to production meteor bundle
120127
WORKDIR /var/www/bundle
121128

bin/docker/cleanup.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Clean out docs
6+
rm -rf /usr/share/doc /usr/share/doc-base /usr/share/man /usr/share/locale /usr/share/zoneinfo
7+
8+
# Clean out package management dirs
9+
rm -rf /var/lib/cache /var/lib/log
10+
11+
# Clean out /tmp
12+
rm -rf /tmp/*
13+
14+
# Clean out Meteor and app src files
15+
rm -rf ~/.meteor /usr/src/meteor
16+
rm /usr/local/bin/meteor

0 commit comments

Comments
 (0)
0