luarocks support
This commit is contained in:
25
Dockerfile
25
Dockerfile
@@ -1,12 +1,29 @@
|
||||
# Build stage
|
||||
FROM rust:alpine AS build
|
||||
# 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 apk update && apk add --no-cache musl-dev
|
||||
RUN cargo build --release
|
||||
|
||||
# Deploy stage
|
||||
FROM alpine
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/target/release/webserver .
|
||||
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"]
|
||||
|
Reference in New Issue
Block a user