Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Setup a Dockerfile for deployment (#26)
Browse files Browse the repository at this point in the history
* setup dockerfile
  • Loading branch information
MDBox authored and feeblefakie committed Aug 21, 2019
1 parent b035b6b commit ce12d79
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile
build
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM openjdk:8u212-jdk-stretch AS builder

RUN mkdir -p /opt/cassy
WORKDIR /opt/cassy

COPY gradle ./gradle
COPY build.gradle ./
COPY gradlew ./gradlew
COPY src ./src

RUN ./gradlew installDist

# Runtime Container
FROM openjdk:8-alpine

RUN apk add sqlite

WORKDIR /opt/cassy

RUN mkdir -p /cassy/data && mkdir -p /cassy/conf

# Copy Build output from Builder Step
COPY --from=builder /opt/cassy/build ./build
COPY scripts ./scripts
COPY conf ./conf

RUN sqlite3 ./cassy.db < ./scripts/db.schema

VOLUME /cassy

ENTRYPOINT ["/bin/sh", "scripts/entrypoint.sh"]
CMD ["--config", "/cassy/conf/backup-server.properties"]

EXPOSE 20051
2 changes: 1 addition & 1 deletion conf/backup-server.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ scalar.backup.cassandra.server.ssh_user=<username>
scalar.backup.cassandra.server.ssh_private_key_path=/path/to/key
scalar.backup.cassandra.server.slave_command_path=/path/to/bin
scalar.backup.cassandra.server.storage_base_uri=s3://<some-bucket-name>
scalar.backup.cassandra.server.metadata_db_url=jdbc:sqlite:<database-name>
scalar.backup.cassandra.server.metadata_db_url=jdbc:sqlite:/cassy/data/cassy.db
scalar.backup.cassandra.server.srv_service_url=<srv-service-url>
11 changes: 11 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

if [ ! -f /cassy/data/cassy.db ]; then
cp cassy.db /cassy/data/;
fi;

if [ ! -f /cassy/conf/backup-server.properties ]; then
cp conf/backup-server.properties /cassy/conf/;
fi;

build/install/cassy/bin/backup-server $@

0 comments on commit ce12d79

Please sign in to comment.