Last active
June 8, 2021 09:33
-
-
Save nuintun/32462a4919bf5f93bdc29010848d33f0 to your computer and use it in GitHub Desktop.
Nextjs Docker 环境
This file contains hidden or 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
# 配置运行环境 | |
FROM node:alpine | |
# 配置工作目录 | |
WORKDIR /wwwroot | |
# 配置 Node 运行模式 | |
ENV NODE_ENV production | |
# 禁用 Next 数据遥测 | |
ENV NEXT_TELEMETRY_DISABLED 1 | |
# 切换国内软件源 | |
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | |
# 安装时区依赖 | |
RUN apk update && apk upgrade -f && apk add bash tzdata | |
# 设置默认时区 | |
RUN cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
# 配置默认端口 | |
EXPOSE 3000 | |
# 运行项目 | |
CMD ["yarn", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment