This commit is contained in:
2024-01-17 11:41:47 +03:00
commit c034dbdae0
24 changed files with 1774 additions and 0 deletions
+12
View File
@@ -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" ]
+3
View File
@@ -0,0 +1,3 @@
FROM cassandra
COPY docker/db/cassandra-init.sh /cassandra-init.sh
RUN chmod +x /cassandra-init.sh
+10
View File
@@ -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 "$@";