forked from scratchfoundation/scratch-gui
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (31 loc) · 956 Bytes
/
Dockerfile
File metadata and controls
44 lines (31 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
ARG BUILD_VERSION=0.0.0
ARG SCRATCHVM_BUILD_IMAGE=scratchvm:$BUILD_VERSION
# stage 0
FROM $SCRATCHVM_BUILD_IMAGE as vm-stage
# stage 1
FROM node:14-alpine AS build-stage
WORKDIR /usr/src/scratch-gui
# Dependencies
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install
# Copy files from scratch VM
RUN rm -rf ./node_modules/scratch-vm
COPY --from=vm-stage /usr/src/scratch-vm ./node_modules/scratch-vm/
# Copy source
COPY . .
# Download micro:bit hex file
RUN npm run prepublish
# Update version number
ARG BUILD_VERSION
RUN npm version $BUILD_VERSION --no-git-tag-version
# Run build
RUN npm run build
# stage 2
FROM nginx:1.20.1 AS run-stage
# copy build files
COPY --from=build-stage /usr/src/scratch-gui/build /usr/share/nginx/html
COPY entrypoint.sh /usr/share/nginx/
RUN chmod +x /usr/share/nginx/entrypoint.sh
ENTRYPOINT ["/usr/share/nginx/entrypoint.sh"]
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]