-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
143 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# base image | ||
FROM --platform=linux/amd64 ubuntu:latest | ||
|
||
# install necessary packages | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
gnupg \ | ||
lsb-release \ | ||
apt-transport-https \ | ||
ca-certificates | ||
|
||
# add Golang offical GPG key | ||
RUN curl -sSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | ||
|
||
RUN apt-get install wget | ||
|
||
RUN wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz | ||
|
||
RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz | ||
|
||
# setup Golang env | ||
ENV GOPATH /go | ||
ENV GOROOT /usr/local/go | ||
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH | ||
|
||
# install MySQL | ||
RUN apt-get update && apt-get install -y mysql-server && apt-get install -y mysql-client | ||
|
||
# set up MySQL root password | ||
ENV MYSQL_ROOT_PASSWORD 123456 | ||
|
||
WORKDIR /app | ||
|
||
COPY my.cnf /etc/mysql/mysql.conf.d/mysqld.cnf | ||
COPY storage/migrations/db.sql /SQL | ||
RUN mysqld_safe & until mysqladmin ping; do sleep 1; done && \ | ||
mysql -e "SOURCE /SQL;" && mysqladmin -u root password 123456 | ||
RUN service mysql restart | ||
|
||
COPY . . | ||
ENV GOOS linux | ||
ENV GOARCH amd64 | ||
RUN GOOS=linux GOARCH=amd64 go build -o /app/server/server ./server | ||
RUN touch /app/server/server.log | ||
RUN chmod a+x /app/server/server | ||
RUN echo "nohup /app/server/server -prover_cycle_time=15000 -log_level=4 > /app/server/server.log 2>&1 &" > /app/start.sh | ||
RUN chmod a+x /app/start.sh | ||
|
||
# expose mysql,server port | ||
EXPOSE 3306 50051 | ||
|
||
# Set the command to be executed when the container starts | ||
CMD ["mysqld"] | ||
#CMD ["nohup /app/server/server -prover_cycle_time=15000 -log_level=4 > /app/server/server.log 2>&1 &"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# | ||
# The MySQL database server configuration file. | ||
# | ||
# One can use all long options that the program supports. | ||
# Run program with --help to get a list of available options and with | ||
# --print-defaults to see which it would actually understand and use. | ||
# | ||
# For explanations see | ||
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html | ||
|
||
# Here is entries for some specific programs | ||
# The following values assume you have at least 32M ram | ||
|
||
[mysqld] | ||
# | ||
# * Basic Settings | ||
# | ||
user = mysql | ||
#pid-file = /run/mysqld/mysqld.pid | ||
#socket = /run/mysqld/mysqld.sock | ||
# port = 3306 | ||
# datadir = /var/lib/mysql | ||
|
||
|
||
# If MySQL is running as a replication slave, this should be | ||
# changed. Ref https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir | ||
# tmpdir = /tmp | ||
# | ||
# Instead of skip-networking the default is now to listen only on | ||
# localhost which is more compatible and is not less secure. | ||
bind-address = 0.0.0.0 | ||
mysqlx-bind-address = 0.0.0.0 | ||
# | ||
# * Fine Tuning | ||
# | ||
key_buffer_size = 16M | ||
# max_allowed_packet = 64M | ||
# thread_stack = 256K | ||
|
||
# thread_cache_size = -1 | ||
|
||
# This replaces the startup script and checks MyISAM tables if needed | ||
# the first time they are touched | ||
myisam-recover-options = BACKUP | ||
|
||
# max_connections = 151 | ||
|
||
# table_open_cache = 4000 | ||
|
||
# | ||
# * Logging and Replication | ||
# | ||
# Both location gets rotated by the cronjob. | ||
# | ||
# Log all queries | ||
# Be aware that this log type is a performance killer. | ||
# general_log_file = /var/log/mysql/query.log | ||
# general_log = 1 | ||
# | ||
# Error log - should be very few entries. | ||
# | ||
log_error = /var/log/mysql/error.log | ||
# | ||
# Here you can see queries with especially long duration | ||
# slow_query_log = 1 | ||
# slow_query_log_file = /var/log/mysql/mysql-slow.log | ||
# long_query_time = 2 | ||
# log-queries-not-using-indexes | ||
# | ||
# The following can be used as easy to replay backup logs or for replication. | ||
# note: if you are setting up a replication slave, see README.Debian about | ||
# other settings you may need to change. | ||
# server-id = 1 | ||
# log_bin = /var/log/mysql/mysql-bin.log | ||
# binlog_expire_logs_seconds = 2592000 | ||
max_binlog_size = 100M | ||
# binlog_do_db = include_database_name | ||
# binlog_ignore_db = include_database_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters