Skip to content

Commit 9af3e51

Browse files
committed
Merge pull request #176 from namtx/chore/update-dockerfile
Optimize Dockerfile to speedup build time
2 parents ed60aa1 + 7202c33 commit 9af3e51

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

Dockerfile

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ FROM python:3
22
WORKDIR /code
33

44
# Node and webpack
5-
RUN apt-get update
6-
RUN apt-get install -y vim
7-
RUN apt-get install curl
8-
RUN apt-get -y install curl gnupg
9-
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash -
10-
RUN apt-get -y install nodejs
5+
RUN apt-get update -qq && \
6+
apt-get install -y --no-install-recommends vim curl gnupg && \
7+
apt-get clean && \
8+
rm -rf /var/lib/apt/lists/*
9+
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
10+
RUN apt-get install -y --no-install-recommends nodejs && \
11+
apt-get clean && \
12+
rm -rf /var/lib/apt/lists/*
1113
RUN npm install -g yarn
1214

13-
ADD requirements.txt /code/requirements.txt
15+
ADD requirements.txt .
1416
RUN pip install -r requirements.txt
1517

16-
RUN yarn
17-
18-
ADD . /code/
19-
RUN chmod +x *.sh
18+
ADD package.json package-lock.json ./
19+
RUN yarn install
2020

2121
# ENV should be configure from outside
2222
# @see docker-compose.yaml
@@ -26,4 +26,7 @@ ENV DB_PASSWORD cuuhomientrung
2626
ENV DB_HOSTNAME localhost
2727
ENV DB_PORT 5432
2828

29+
ADD . /code/
30+
RUN chmod +x *.sh
31+
2932
CMD ["bash","-c","env > .env && ./run_server.sh"]

0 commit comments

Comments
 (0)