Add docker support

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
Rahul Rudragoudar 2021-03-29 15:32:06 +05:30
parent 8c8bda8d59
commit 0b3cddc09d
No known key found for this signature in database
GPG Key ID: 0D2CE231A7287EBC
2 changed files with 48 additions and 0 deletions

37
Dockerfile Normal file
View File

@ -0,0 +1,37 @@
FROM alpine:latest AS base-builder
ARG SBT_VERSION=1.3.13
RUN apk add --no-cache bash
ENV JAVA_HOME="/usr/lib/jvm/default-jvm/"
RUN apk add openjdk11-jre
ENV PATH=$PATH:${JAVA_HOME}/bin
RUN \
wget -O sbt-$SBT_VERSION.tgz https://github.com/sbt/sbt/releases/download/v$SBT_VERSION/sbt-$SBT_VERSION.tgz && \
tar -xzvf sbt-$SBT_VERSION.tgz && \
rm sbt-$SBT_VERSION.tgz
ENV PATH=$PATH:/sbt/bin/
FROM base-builder AS builder
WORKDIR /build
COPY lib/ lib/
COPY project/plugins.sbt project/
COPY build.sbt .
COPY src/ src/
RUN sbt assembly
FROM alpine:latest AS base-core
ENV JAVA_HOME="/usr/lib/jvm/default-jvm/"
RUN apk add openjdk11-jre
ENV PATH=$PATH:${JAVA_HOME}/bin
FROM base-core
WORKDIR /lc-core
COPY --from=builder /build/target/scala-2.13/LibreCaptcha.jar .
RUN mkdir data/
EXPOSE 8888
CMD [ "java", "-jar", "LibreCaptcha.jar" ]

11
docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
version: "3.8"
services:
lc-core:
container_name: "libre-captcha"
build: ./
image: librecapthca/lc-core:latest
volumes:
- "./docker-data:/lc-core/data"
ports:
- "8888:8888"