Changed Dockerfile

This commit is contained in:
Piyush मिश्रः 2023-02-25 19:27:09 +01:00
parent f8515bbf50
commit 2d4a394daf
6 changed files with 32 additions and 28 deletions

View File

@ -1,8 +1,12 @@
version: '2'
version: "3.2"
services:
lupt:
container_name: lupt-server
web:
container_name: lupt-chat
build: .
ports:
- "8080:8080"
- "8080:8081"
volumes:
- type: bind
source: ./etc
target: /app/lupt/etc

View File

@ -1 +1,2 @@
/target
/etc

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
/target
/config.json
/etc/config.json
/localhost-key.pem
/localhost.pem
/docker-compose.yml

View File

@ -1,24 +1,29 @@
FROM rust:1.58-alpine as builder
FROM rust:1-alpine3.16
ENV PATH="/app/bin:${PATH}"
ENV APP=lupt
RUN mkdir -pv /app
COPY ./Cargo.toml /app
COPY ./Cargo.lock /app
COPY ./config.json /app
COPY ./run-lupt.sh /app/bin/run-lupt.sh
COPY ./src /app/src
COPY ./static /app/static
RUN cargo search --limit 0
RUN apk upgrade --update-cache --available
RUN apk add musl-dev openssl-dev
RUN apk upgrade --update-cache --available && \
apk add musl-dev && \
apk add pkgconfig && \
apk add openssl-dev && \
rm -rf /var/cache/apk/*
WORKDIR /app
WORKDIR /app/${APP}
RUN mkdir /app/${APP}/etc
RUN cargo build
RUN cp -v target/debug/lupt bin
COPY . .
RUN cargo build --release
RUN cp target/release/lupt .
RUN cargo clean
RUN chmod 755 bin/run-lupt.sh
RUN /bin/sh -c 'export FILE=~/.cargo/registry/cache/; if [ -e $FILE ] ; then rm -rf $FILE ; fi'
RUN /bin/sh -c 'export FILE=~/.cargo/registry/src/; if [ -e $FILE ] ; then rm -rf $FILE ; fi'
RUN rm -rf /usr/local/rustup/ /usr/local/cargo/
RUN apk del gcc
CMD ["run-lupt.sh"]
EXPOSE 8080/tcp
CMD ["${APP}", "--bind_address", "0.0.0.0", "--port", "8080", "--config-file", "/app/${APP}/etc/config.json", "--static_path", "/app/${APP}/static/"]

View File

@ -1,6 +0,0 @@
#!/bin/sh
set -e
echo => Starting lupt server
/app/bin/lupt --config-file /app/config.json --static_path /app/static --bind_address 0.0.0.0 --port 8080