diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a030541 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules/ +logs/ +.env +src/front/build +docker \ No newline at end of file diff --git a/.gitignore b/.gitignore index 66dba91..1ebcf3b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ yarn-error.log .env logs/ .DS_Store -src/front/build -spec/coverage \ No newline at end of file +spec/coverage +build \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8981fd4..5bcfb26 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,9 @@ cache: paths: - node_modules/ +script: + - apk --no-cache add --virtual builds-deps build-base python + stages: - build - test diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b90bb35 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM node:12-alpine as builder + +COPY . /usr/src/app + +WORKDIR /usr/src/app + +RUN apk update && \ + apk upgrade && \ + apk --no-cache add --virtual builds-deps build-base python && \ + yarn && \ + yarn build && \ + rm -r ./node_modules && \ + yarn --production && \ + touch .env +# End of build stage + +FROM node:12-alpine + +COPY --from=builder /usr/src/app /usr/src/app + +WORKDIR /usr/src/app + +CMD [ "yarn", "start" ]