Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
feat: Optimize Docker build process
Browse files Browse the repository at this point in the history
  • Loading branch information
PromiseFru committed Jul 19, 2024
1 parent 37e2701 commit 8ca8d42
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
25 changes: 16 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ RUN apk add --no-cache \

# import work files
WORKDIR /app

COPY package.json ./
COPY scripts ./scripts

RUN yarn install --no-lockfile

COPY . .
# build production files
ARG SWOB_BE_HOST
Expand All @@ -23,16 +29,17 @@ ARG SWOB_SSL_ENABLE
ARG SWOB_SSL_CRT_FILE
ARG SWOB_SSL_KEY_FILE

RUN export SWOB_BE_HOST=${SWOB_BE_HOST} \
SWOB_GS_HOST=${SWOB_GS_HOST} \
SWOB_RECAPTCHA_ENABLE=${SWOB_RECAPTCHA_ENABLE} \
SWOB_RECAPTCHA_SITE_KEY=${SWOB_RECAPTCHA_SITE_KEY} \
SWOB_SSL_ENABLE=${SWOB_SSL_ENABLE} \
SWOB_SSL_CRT_FILE=${SWOB_SSL_CRT_FILE} \
SWOB_SSL_KEY_FILE=${SWOB_SSL_KEY_FILE} \
SWOB_SSL_ENABLE=${SWOB_SSL_ENABLE}
ENV SWOB_BE_HOST=${SWOB_BE_HOST}
ENV SWOB_GS_HOST=${SWOB_GS_HOST}
ENV SWOB_RECAPTCHA_ENABLE=${SWOB_RECAPTCHA_ENABLE}
ENV SWOB_RECAPTCHA_SITE_KEY=${SWOB_RECAPTCHA_SITE_KEY}
ENV SWOB_SSL_ENABLE=${SWOB_SSL_ENABLE}
ENV SWOB_SSL_CRT_FILE=${SWOB_SSL_CRT_FILE}
ENV SWOB_SSL_KEY_FILE=${SWOB_SSL_KEY_FILE}
ENV SWOB_SSL_ENABLE=${SWOB_SSL_ENABLE}

RUN make
RUN ./scripts/create_env.sh && \
yarn build

# base image for apache
FROM httpd:2.4 as apache
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ config:

build:
@echo "[!] Creating production build ..."
yarn install --no-lockfile && \
yarn install --no-lockfile
yarn build

deploy:
Expand Down

0 comments on commit 8ca8d42

Please sign in to comment.