Skip to content

Commit

Permalink
Fix some bugs in Docker. [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxie committed Aug 30, 2018
1 parent 8234966 commit e2804a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ docker pull zjhzxhz/voj.web
## Run Web Application

```
docker run -d -p 3306:3306 -p 8080:8080 -p 61616:61616 zjhzxhz/voj.web
docker run -d --name voj.web -p 8080:8080 zjhzxhz/voj.web
```

The web application is available at [http://localhost:8080/voj](http://localhost:8080/voj).

## Build Docker Image for Judger Application

```
Expand All @@ -35,5 +37,5 @@ docker pull zjhzxhz/voj.judger
## Run Judger Application

```
docker run -d zjhzxhz/voj.judger
docker run -d --name voj.judger --link voj.web zjhzxhz/voj.judger
```
8 changes: 6 additions & 2 deletions docker/judger/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ MAINTAINER Haozhe Xie "cshzxie@gmail.com"
# User Settings
ARG MYSQL_ROOT_PASS=dBuZNz6tDKhgZjHX
ARG MYSQL_USER_PASS=U3bEwhRHnD6xNVpb
ARG ACTIVEMQ_ADDR=localhost:61616
ARG MYSQL_HOST=voj.web
ARG MYSQL_PORT=3306
ARG ACTIVEMQ_HOST=voj.web
ARG ACTIVEMQ_PORT=61616

# Set environment variables.
ENV HOME /root
Expand Down Expand Up @@ -33,9 +36,10 @@ RUN rm apache-maven-3.5.4-bin.tar.gz
# Setup Judger Project
RUN apt-get install -y git gcc g++ make
RUN git clone https://github.com/hzxie/voj.git
RUN sed -i "s@jdbc.url = jdbc:mysql://localhost:3306@jdbc.url = jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT}@g" voj/judger/src/main/resources/voj.properties
RUN sed -i "s/jdbc.username = root/jdbc.username = voj/g" voj/judger/src/main/resources/voj.properties
RUN sed -i "s/jdbc.password = /jdbc.password = ${MYSQL_USER_PASS}/g" voj/judger/src/main/resources/voj.properties
RUN sed -i "s/localhost:61616/${ACTIVEMQ_ADDR}/g" voj/judger/src/main/resources/voj.properties
RUN sed -i "s/localhost:61616/${ACTIVEMQ_HOST}:${ACTIVEMQ_PORT}/g" voj/judger/src/main/resources/voj.properties
RUN mkdir -p voj/target/classes
RUN $M2_HOME/bin/mvn package -DskipTests -f voj/judger/pom.xml

Expand Down
1 change: 1 addition & 0 deletions docker/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ WORKDIR /root
# Install MySQL and Set up MySQL
RUN apt-get update
RUN apt-get install -y mariadb-server mariadb-client
RUN sed -i "s/127\.0\.0\.1/0.0.0.0/g" /etc/mysql/mariadb.conf.d/50-server.cnf
RUN /etc/init.d/mysql start && \
/usr/bin/mysqladmin -u root password '${MYSQL_ROOT_PASS}' && \
mysql -e "CREATE DATABASE voj" && \
Expand Down

0 comments on commit e2804a2

Please sign in to comment.