forked from magento/pwa-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.dev
50 lines (42 loc) · 1.71 KB
/
Dockerfile.dev
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
45
46
47
48
49
50
##############################################################
# This file is intended to be used with ./docker-compose.yml #
##############################################################
FROM node:10.14.1-alpine as build
# working directory
WORKDIR /usr/src/app
# global environment setup : yarn + dependencies needed to support node-gyp
RUN apk --no-cache --virtual add \
python \
make \
g++ \
yarn
# copy just the dependency files and configs needed for install
COPY packages/peregrine/package.json ./packages/peregrine/package.json
COPY packages/pwa-buildpack/package.json ./packages/pwa-buildpack/package.json
COPY packages/upward-js/package.json ./packages/upward-js/package.json
COPY packages/upward-spec/package.json ./packages/upward-spec/package.json
COPY packages/venia-concept/package.json ./packages/venia-concept/package.json
COPY package.json yarn.lock babel.config.js browserslist.js magento-compatibility.js ./
# install dependencies with yarn
RUN yarn install --frozen-lockfile
# copy over the rest of the package files
COPY packages ./packages
# set in docker-compose
ARG ENVFILEPATH
# copy configuration env file from host file system to venia-concept .env for build
COPY ${ENVFILEPATH} ./packages/venia-concept/.env
# build the app
RUN yarn run build
# MULTI-STAGE BUILD
FROM node:10.14.1-alpine
# working directory
WORKDIR /usr/src/app
# node:alpine comes with a configured user and group
RUN chown -R node:node /usr/src/app
# copy build from previous stage
COPY --from=build /usr/src/app .
USER node
# Pass the `HOST` arg from docker-compose args and set it to the HOST
ARG HOST
# command to run application
CMD [ "yarn", "workspace", "@magento/venia-concept", "run", "watch", "-- --host ${HOST}"]