diff --git a/.gitignore b/.gitignore index 2ae19fa..55c804b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ examples/fastpastebin.yaml dist/ data/ + +*DS_Store* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8054cd3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:1.13-alpine AS build + +WORKDIR /go/src/gitlab.com/pztrn/fastpastebin +COPY . . + +WORKDIR /go/src/gitlab.com/pztrn/fastpastebin/cmd/fastpastebin + +RUN go build + +FROM alpine:3.10 +LABEL maintainer "Stanislav N. " + +COPY --from=build /go/src/gitlab.com/pztrn/fastpastebin/cmd/fastpastebin/fastpastebin /app/fastpastebin +COPY docker/fastpastebin.docker.yaml /app/fastpastebin.yaml + +EXPOSE 25544 +ENTRYPOINT [ "/app/fastpastebin", "-config", "/app/fastpastebin.yaml" ] diff --git a/docker/docker-compose.yml b/docker-compose.yml similarity index 78% rename from docker/docker-compose.yml rename to docker-compose.yml index af70478..89403ba 100644 --- a/docker/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: container_name: database restart: always volumes: - - mysql:/var/lib/mysql + - fastpastebin_mysql:/var/lib/mysql environment: - MYSQL_RANDOM_ROOT_PASSWORD=yes - MYSQL_DATABASE=fastpastebin @@ -23,14 +23,14 @@ services: depends_on: - database volumes: - - ./fastpastebin.docker.yaml:/app/fastpastebin.yaml:ro + - ./docker/fastpastebin.docker.yaml:/app/fastpastebin.yaml:ro # ports: # - 25544:25544 web: image: nginx:1.16-alpine container_name: nginx volumes: - - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro + - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro ports: - 8080:80 depends_on: diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index a7e6a15..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.11-alpine AS build - -WORKDIR /app - -RUN apk add git && \ - go get -u -v gitlab.com/pztrn/fastpastebin/cmd/fastpastebin - -FROM alpine:3.10 -LABEL maintainer "Stanislav N. " - -COPY --from=build /go/bin/fastpastebin /app/fastpastebin -COPY fastpastebin.docker.yaml /app/fastpastebin.yaml - -EXPOSE 25544 -ENTRYPOINT [ "/app/fastpastebin", "-config", "/app/fastpastebin.yaml" ]