init
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
FROM golang as builder
|
||||
RUN mkdir -p /build/src
|
||||
WORKDIR /build
|
||||
COPY ./src/. /build/src/
|
||||
COPY ./go.mod /build/
|
||||
RUN go mod vendor && go test ./src/ && CGO_ENABLED=0 GOOS=linux go build -o apiservice ./src/main.go
|
||||
|
||||
FROM alpine
|
||||
ENV TZ=Europe/Helsinki
|
||||
RUN apk add --no-cache tzdata && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
COPY --from=builder /build/apiservice .
|
||||
ENTRYPOINT [ "./apiservice" ]
|
||||
@@ -0,0 +1,3 @@
|
||||
FROM cassandra
|
||||
COPY docker/db/cassandra-init.sh /cassandra-init.sh
|
||||
RUN chmod +x /cassandra-init.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
cat >/import.cql <<EOF
|
||||
CREATE keyspace IF NOT EXISTS ${CASSANDRA_KEYSPACE} with replication = {'class':'SimpleStrategy', 'replication_factor' : 1};
|
||||
USE ${CASSANDRA_KEYSPACE};
|
||||
CREATE TABLE IF NOT EXISTS ${TABLE_NAME}(id TIMEUUID, firstname TEXT, lastname TEXT, birthday date, currentlocation TEXT, userpicture TEXT, certificate TEXT, PRIMARY KEY(id));
|
||||
EOF
|
||||
|
||||
bash -c 'sleep 60; cqlsh -f /import.cql;' &
|
||||
exec /docker-entrypoint.sh "$@";
|
||||
|
||||
Reference in New Issue
Block a user