From 0a525248ac479df9baf6c52d2ef107da5c533a5a Mon Sep 17 00:00:00 2001 From: httpjamesm Date: Wed, 28 Dec 2022 00:27:37 -0500 Subject: [PATCH] feat: docker docs: docker deployment chore: gitignore --- .gitignore | 2 ++ Dockerfile | 20 ++++++++++++++++++++ README.md | 12 +++++++++++- docker-compose.example.yml | 11 +++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 docker-compose.example.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..00a3413 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.env +docker-compose.yml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..75148a0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM golang:1.18-alpine + +RUN apk add musl-dev +RUN apk add libc-dev +RUN apk add gcc + +WORKDIR /app + +COPY go.mod ./ +COPY go.sum ./ + +RUN go mod download + +COPY ./ /app + +RUN go build -o /anonymousoverflow + +EXPOSE 8080 + +CMD ["/anonymousoverflow"] \ No newline at end of file diff --git a/README.md b/README.md index 86341f4..f37ebc5 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,14 @@ becomes ``` ${instanceURL}/questions/43743250/using-libsodium-xchacha20-poly1305-for-large-files -``` \ No newline at end of file +``` + +## How to deploy + +AnonymousOverflow uses Docker for deployment. + +Install Docker for your platform and copy the `docker-compose.example.yml` file to `docker-compose.yml`. + +Then, tweak settings if needed. + +Run `docker compose up -d` to build and start the container. \ No newline at end of file diff --git a/docker-compose.example.yml b/docker-compose.example.yml new file mode 100644 index 0000000..2fc1f0f --- /dev/null +++ b/docker-compose.example.yml @@ -0,0 +1,11 @@ +version: '3' + +services: + anonymousoverflow: + container_name: 'app' + build: + context: . + network: 'host' + ports: + - '80:8080' + restart: 'always' \ No newline at end of file