diff --git a/.dockerignore b/.dockerignore index 747089b2..50eee081 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,6 +2,8 @@ !public/ !src/ !.npmrc +!.eslintrc.json +!.prettierrc !package-lock.json !package.json !tsconfig.json diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 00000000..ffd2ef08 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,15 @@ +name: Build Docker image + +on: + push: + branches: + - master + pull_request: + +jobs: + build-docker: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - run: docker build -t excalidraw . diff --git a/Dockerfile b/Dockerfile index 298b4407..eb9da172 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,14 @@ -FROM node:14-alpine AS deps - -ARG REACT_APP_INCLUDE_GTAG=false - -RUN mkdir /opt/node_app && chown node:node /opt/node_app -WORKDIR /opt/node_app - -USER node - -COPY package.json package-lock.json ./ -RUN npm install --no-optional && npm cache clean --force -ENV PATH /opt/node_app/node_modules/.bin:$PATH - -WORKDIR /opt/node_app -COPY . . - FROM node:14-alpine AS build +WORKDIR /opt/node_app + +COPY package.json package-lock.json ./ +RUN npm i --no-optional + +ARG REACT_APP_INCLUDE_GTAG=false ARG NODE_ENV=production -WORKDIR /opt/node_app -COPY --from=deps /opt/node_app . +COPY . . RUN npm run build:app:docker FROM nginx:1.17-alpine