diff --git a/deploy/task3/docker-compose.yml b/deploy/task3/docker-compose.yml new file mode 100644 index 0000000..d385ce8 --- /dev/null +++ b/deploy/task3/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3' +services: + backend2: + build: + dockerfile: ./task3-backend/Dockerfile + context: ../.. + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + - "./postbox:/app/postbox" + - "../../keys/letter:/app/letter" + restart: unless-stopped + networks: + net: + ipv4_address: 10.103.204.3 + +networks: + net: + external: + name: tasks-net \ No newline at end of file diff --git a/deploy/task3/postbox/.gitkeep b/deploy/task3/postbox/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/task3-backend/Dockerfile b/task3-backend/Dockerfile new file mode 100644 index 0000000..c79e0fd --- /dev/null +++ b/task3-backend/Dockerfile @@ -0,0 +1,30 @@ +FROM alpine as builder + +ENV GOPATH /root/go +ENV PATH ${GOPATH}/bin:${PATH} + +RUN mkdir -p /app +WORKDIR /app + +RUN apk add --no-cache go git curl gcc g++ make + +COPY . . +RUN go build -o task3 github.com/mainnika/a-quest/task3-backend + +FROM alpine + +ENV GOPATH /root/go +ENV PATH ${GOPATH}/bin:${PATH} + +RUN mkdir -p /app /app/postbox +WORKDIR /app + +COPY --from=builder /app/task3 . +COPY --from=builder /app/task3-backend/config config + +EXPOSE 8081 +EXPOSE 31337 + +VOLUME /app/postbox + +CMD ["/app/task3"] \ No newline at end of file