30 lines
1005 B
Docker
30 lines
1005 B
Docker
# Lua Build
|
|
FROM nickblah/lua:5.4-luarocks-alpine AS build
|
|
RUN apk add --no-cache build-base rust cargo lua5.4-dev pkgconfig openssl-dev m4 bsd-compat-headers
|
|
# Install lua modules here.
|
|
RUN luarocks install luasec
|
|
RUN luarocks install luasocket
|
|
RUN luarocks install lua-cjson
|
|
RUN luarocks install base64
|
|
RUN luarocks install inspect
|
|
|
|
# Need to build rust in this container too due to version mismatch between
|
|
# build environments of lua and rust
|
|
WORKDIR /app
|
|
COPY . .
|
|
RUN cargo build --release
|
|
|
|
# Deploy stage
|
|
FROM alpine
|
|
WORKDIR /app
|
|
RUN apk update && apk add --no-cache ca-certificates openssl libgcc lua5.4-libs
|
|
|
|
COPY --from=build /usr/local/bin/lua /usr/local/bin/lua
|
|
COPY --from=build /usr/local/bin/luarocks /usr/local/bin/luarocks
|
|
COPY --from=build /usr/local/lib/lua /usr/local/lib/lua
|
|
COPY --from=build /usr/local/share/lua /usr/local/share/lua
|
|
COPY --from=build /usr/local/lib/luarocks /usr/local/lib/luarocks
|
|
COPY --from=build /app/target/release/webserver /app/webserver
|
|
|
|
CMD ["./webserver"]
|