Created
June 21, 2020 06:15
-
-
Save leolord/91fe16a89bfede8e85e5322f2f18350c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 指定一些变量 | |
ARG PROOT=/root/app | |
ARG APP_PORT=3000 | |
# 指定底包 | |
FROM alpine:latest | |
LABEL version="1.0" | |
LABEL description="node docker file based on alpine which is quite small." | |
LABEL maintainer="leolord([email protected])" | |
# 使用阿里云镜像,并安装必须依赖 | |
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories | |
RUN apk update && apk add nginx nodejs npm | |
RUN echo 'home=https://npm.taobao.org \ | |
registry=https://registry.npm.taobao.org/' > ~/.npmrc | |
RUN npm install -g yarn | |
# 当前工作目录 | |
RUN mkdir -p ${PROOT} | |
WORKDIR ${PROOT} | |
# 设置环境变量 | |
ENV NODE_ENV production | |
ENV WORKER 2 | |
# 复制文件 | |
COPY from to | |
# 安装依赖 | |
RUN yarn | |
# 指定监听端口 | |
EXPOSE ${APP_PORT}/tcp | |
EXPOSE ${APP_PORT}/udp | |
# 启动服务 | |
CMD ["yarn", "run", "dev", "--port=3000"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment