@@ -2,56 +2,23 @@ FROM node:14 AS development
22
33ENV USERNAME timetracker
44ENV HOME /home/${USERNAME}
5- ENV CHROME_BIN /opt/google/chrome/google-chrome
6- # Essential tools and xvfb
7- RUN apt-get update && apt-get install -y \
8- software-properties-common \
9- unzip \
10- curl \
11- wget \
12- xvfb
13-
14- # Chrome browser to run the tests
15- ARG CHROME_VERSION=65.0.3325.181
16- RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add \
17- && wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
18- && dpkg -i google-chrome-stable_current_amd64.deb || true
19- RUN apt-get install -y -f \
20- && rm -rf /var/lib/apt/lists/*
21-
22- # Disable the SUID sandbox so that chrome can launch without being in a privileged container
23- RUN dpkg-divert --add --rename --divert /opt/google/chrome/google-chrome.real /opt/google/chrome/google-chrome \
24- && echo "#! /bin/bash\n exec /opt/google/chrome/google-chrome.real --no-sandbox --disable-setuid-sandbox \"\$ @\" " > /opt/google/chrome/google-chrome \
25- && chmod 755 /opt/google/chrome/google-chrome
26-
27- # Chrome Driver
28- ARG CHROME_DRIVER_VERSION=2.37
29- RUN mkdir -p /opt/selenium \
30- && curl http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -o /opt/selenium/chromedriver_linux64.zip \
31- && cd /opt/selenium; unzip /opt/selenium/chromedriver_linux64.zip; rm -rf chromedriver_linux64.zip; ln -fs /opt/selenium/chromedriver /usr/local/bin/chromedriver;
32-
335RUN useradd -ms /bin/bash ${USERNAME}
34-
356WORKDIR ${HOME}/time-tracker-ui
367COPY . .
37- RUN rm -f .env
388RUN chown ${USERNAME}:${USERNAME} -R ${HOME}/time-tracker-ui
399RUN chmod -R 777 ${HOME}/time-tracker-ui
4010
41-
4211USER ${USERNAME}
4312RUN npm cache clean --force && npm install
4413EXPOSE 4200
4514EXPOSE 9876
46- CMD npm run config && ${HOME}/time-tracker-ui/node_modules/.bin/ng serve --host 0.0.0.0 --disableHostCheck
15+ CMD ${HOME}/time-tracker-ui/node_modules/.bin/ng serve --host 0.0.0.0 --disableHostCheck
4716
4817
4918
5019FROM development as build
5120COPY .env .
52- RUN npm run config && npm run build
53-
54-
21+ RUN npm run build
5522
5623FROM nginx:1.21 AS production
5724
@@ -60,7 +27,7 @@ RUN useradd -ms /bin/bash ${USERNAME}
6027
6128COPY nginx.conf /etc/nginx/conf.d/default.conf
6229COPY --from=build /home/timetracker/time-tracker-ui/dist/time-tracker /usr/share/nginx/html
63-
30+ COPY .env /usr/share/nginx/html
6431RUN chown -R ${USERNAME}:${USERNAME} /var/cache/nginx && \
6532 chown -R ${USERNAME}:${USERNAME} /var/log/nginx && \
6633 chown -R ${USERNAME}:${USERNAME} /etc/nginx/conf.d
@@ -74,4 +41,4 @@ RUN touch /var/run/nginx.pid && chown -R ${USERNAME}:${USERNAME} /var/run/nginx.
7441
7542# USER ${USERNAME}
7643
77- EXPOSE 80
44+ EXPOSE 80
0 commit comments