forked from Hanabi-Live/hanabi-live
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (31 loc) · 1.05 KB
/
Copy pathDockerfile
File metadata and controls
39 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Build and run the Golang server inside Docker.
FROM ubuntu:bionic
RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common && \
add-apt-repository ppa:longsleep/golang-backports && \
apt-get update
RUN apt-get install -y --no-install-recommends \
curl \
gpg-agent \
git \
golang-go \
mariadb-client
RUN mkdir -p /root/hanabi-live
WORKDIR /root/hanabi-live
# Warm the cache so we don't need to download modules again every time the code changes
# https://github.com/golang/go/issues/26610
COPY ./src/go.mod ./src/go.sum ./src/
RUN cd src && go mod download
# Build the server code
COPY ./src ./src
RUN cd src && go build -o ../hanabi-live
COPY .env_template .env
RUN echo 'DB_HOST=mariadb' >> .env
CMD /bin/bash -c '\
source .env; \
echo "Waiting for mariadb to start..."; \
while ! mysqladmin ping --silent --host="$DB_HOST" --user="$DB_USER" --password="$DB_PASS"; do \
sleep 2; \
done; \
echo "Starting hanabi-live server"; \
./hanabi-live'