-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDockerfile.alpine
More file actions
46 lines (39 loc) · 1.17 KB
/
Dockerfile.alpine
File metadata and controls
46 lines (39 loc) · 1.17 KB
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
# 阶段1: 构建阶段
FROM alpine:3.19 as builder
ENV TZ="Asia/Shanghai"
# 安装完整构建依赖
RUN apk update && \
apk add --no-cache \
tzdata \
git \
build-base \
autoconf \
readline-dev \
openssl-dev \
musl-dev \
linux-headers \
wget \
unzip && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone
# 修复编译参数
WORKDIR /build
ADD . .
RUN make MALLOC=libc
# 阶段2: 运行时镜像
FROM alpine:3.19
ENV TZ="Asia/Shanghai"
RUN apk add --no-cache libgcc readline openssl && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone
COPY --from=builder /build/silly /opt/
COPY --from=builder /build/lualib /opt/lualib
COPY --from=builder /build/luaclib /opt/luaclib
COPY --from=builder /build/src/*.h /opt/include/
COPY --from=builder /build/deps/lua/lua.hpp /opt/include/lua/
COPY --from=builder /build/deps/lua/luaconf.h /opt/include/lua/
COPY --from=builder /build/deps/lua/lua.h /opt/include/lua/
COPY --from=builder /build/deps/lua/lualib.h /opt/include/lua/
COPY --from=builder /build/deps/lua/lauxlib.h /opt/include/lua/
WORKDIR /app
ENTRYPOINT ["/opt/silly"]