Adding support for Docker
This commit is contained in:
parent
869a6fa384
commit
6d06d71c31
2 changed files with 53 additions and 0 deletions
29
README.md
29
README.md
|
@ -88,3 +88,32 @@ The **config.json** file contains the following settings:
|
||||||
6. upload - Settings for the upload server.
|
6. upload - Settings for the upload server.
|
||||||
If one of the settings are changed, the server will reload the configuration.
|
If one of the settings are changed, the server will reload the configuration.
|
||||||
Except for the absoluteServePath.
|
Except for the absoluteServePath.
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
To build the image run: ```docker build -t simplft .``` and to run the server:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -d \
|
||||||
|
-it \
|
||||||
|
--name devtest \
|
||||||
|
--mount type=bind,source="/Users/denis/Downloads",target=/externalVolume \
|
||||||
|
-p 8080:8080 -p 8081:8081 \
|
||||||
|
simplft
|
||||||
|
```
|
||||||
|
|
||||||
|
* ```-p PORT1:PORT2``` - PORT1 is the host machine's port mapped to the container's PORT2
|
||||||
|
* ```source="/Users/denis/Downloads"``` - This path should be changed to the path from where you want to serve files.
|
||||||
|
|
||||||
|
To stop the server you will first need to identify the running container and the stop it via
|
||||||
|
```docker container stop CONTAINER ID```
|
||||||
|
|
||||||
|
##### Stopping the server
|
||||||
|
|
||||||
|
```
|
||||||
|
➜ server git:(master) ✗ docker container ls
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
90b6f00b1331 simplft "./simplFTP -confi..." 2 minutes ago Up 2 minutes 0.0.0.0:8081->8081/tcp, 0.0.0.0:32768->8080/tcp devtest
|
||||||
|
➜ server git:(master) ✗ docker container stop 90b6f00b1331
|
||||||
|
90b6f00b1331
|
||||||
|
```
|
24
server/Dockerfile
Normal file
24
server/Dockerfile
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# Golang is our base images.
|
||||||
|
FROM golang:1.7
|
||||||
|
|
||||||
|
# Make a directory called simplFT
|
||||||
|
RUN mkdir -p /go/src/github.com/metonimie/simplFT/server
|
||||||
|
|
||||||
|
# Copy the current dir contents into simplFT
|
||||||
|
ADD . /go/src/github.com/metonimie/simplFT/server
|
||||||
|
|
||||||
|
# Set the working directory to simplFT
|
||||||
|
WORKDIR /go/src/github.com/metonimie/simplFT/server
|
||||||
|
|
||||||
|
# Make port 80 available to the world outside this container
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN go get "github.com/zyxar/image2ascii/ascii"
|
||||||
|
RUN go get "github.com/spf13/viper"
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
RUN go build ./simplFTP.go
|
||||||
|
|
||||||
|
# Run simplFT when the container launches
|
||||||
|
CMD ["./simplFTP", "-config-name", "docker-config"]
|
Loading…
Reference in a new issue