mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix docker build (#2348)
* .eslintrc.json is required to build using react-scripts
* Remove the extra "deps" step
This step can be done as part of the build (faster and more reliable).
* Add a GitHub Actions to build the Docker image
Make sure that "docker build" is working on every pull request before landing on master.
* Update package-lock.json
* Add .prettierrc in the Docker image to avoid warnings in the build step
* Revert "Update package-lock.json"
This reverts commit 7ef2eaadfa
.
* Make sure that the 'node_modules' layer can be cached
if package and package-lock.json didn't changed
This commit is contained in:
parent
a05679b3c5
commit
5b63371c14
3 changed files with 24 additions and 18 deletions
|
@ -2,6 +2,8 @@
|
|||
!public/
|
||||
!src/
|
||||
!.npmrc
|
||||
!.eslintrc.json
|
||||
!.prettierrc
|
||||
!package-lock.json
|
||||
!package.json
|
||||
!tsconfig.json
|
||||
|
|
15
.github/workflows/build-docker.yml
vendored
Normal file
15
.github/workflows/build-docker.yml
vendored
Normal file
|
@ -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 .
|
25
Dockerfile
25
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue