mirror of https://github.com/mainnika/a-quest.git
				
				
				
			
							parent
							
								
									2408336bdd
								
							
						
					
					
						commit
						cb34ae11eb
					
				@ -0,0 +1,20 @@ | 
				
			||||
version: "3.7" | 
				
			||||
 | 
				
			||||
services: | 
				
			||||
  redis: | 
				
			||||
    image: redis | 
				
			||||
    #    volumes: | 
				
			||||
    #  - "./default.conf:/etc/nginx/conf.d/default.conf" | 
				
			||||
    #  - "./html:/usr/share/nginx/html" | 
				
			||||
    restart: unless-stopped | 
				
			||||
    networks: | 
				
			||||
      - net | 
				
			||||
 | 
				
			||||
networks: | 
				
			||||
  net: | 
				
			||||
    driver: bridge | 
				
			||||
    name: tasks-net | 
				
			||||
    ipam: | 
				
			||||
      driver: default | 
				
			||||
      config: | 
				
			||||
        - subnet:  10.103.0.1/16 | 
				
			||||
@ -0,0 +1,27 @@ | 
				
			||||
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 | 
				
			||||
 | 
				
			||||
COPY . . | 
				
			||||
RUN go build -o task1 github.com/mainnika/a-quest/task1-backend | 
				
			||||
 | 
				
			||||
FROM alpine | 
				
			||||
 | 
				
			||||
ENV GOPATH /root/go | 
				
			||||
ENV PATH ${GOPATH}/bin:${PATH} | 
				
			||||
 | 
				
			||||
RUN mkdir -p /app | 
				
			||||
WORKDIR /app | 
				
			||||
 | 
				
			||||
COPY --from=builder task1 . | 
				
			||||
COPY --from=builder task1-backend/config . | 
				
			||||
 | 
				
			||||
EXPOSE 8081 | 
				
			||||
 | 
				
			||||
CMD ["/app/task1"] | 
				
			||||
@ -0,0 +1,40 @@ | 
				
			||||
upstream backend1 { | 
				
			||||
    server backend1:8081; | 
				
			||||
} | 
				
			||||
 | 
				
			||||
server { | 
				
			||||
    listen       80; | 
				
			||||
    server_name  _; | 
				
			||||
 | 
				
			||||
    location / { | 
				
			||||
 | 
				
			||||
     if ($request_method = 'OPTIONS') { | 
				
			||||
        add_header 'Access-Control-Allow-Origin' '*'; | 
				
			||||
        add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS'; | 
				
			||||
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; | 
				
			||||
        add_header 'Access-Control-Max-Age' 1728000; | 
				
			||||
        add_header 'Content-Type' 'text/plain; charset=utf-8'; | 
				
			||||
        add_header 'Content-Length' 0; | 
				
			||||
        return 204; | 
				
			||||
     } | 
				
			||||
 | 
				
			||||
     if ($request_method = 'GET') { | 
				
			||||
        add_header 'Access-Control-Allow-Origin' '*'; | 
				
			||||
        add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS'; | 
				
			||||
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; | 
				
			||||
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; | 
				
			||||
     } | 
				
			||||
 | 
				
			||||
        root   /usr/share/nginx/html; | 
				
			||||
        index  index.html index.htm; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    error_page   500 502 503 504  /50x.html; | 
				
			||||
    location = /50x.html { | 
				
			||||
        root   /usr/share/nginx/html; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    location = /answer { | 
				
			||||
        proxy_pass   http://backend1; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,23 @@ | 
				
			||||
version: '3' | 
				
			||||
services: | 
				
			||||
  static: | 
				
			||||
    image: nginx | 
				
			||||
    volumes: | 
				
			||||
      - "./default.conf:/etc/nginx/conf.d/default.conf" | 
				
			||||
      - "../../build/task1:/usr/share/nginx/html" | 
				
			||||
    restart: unless-stopped | 
				
			||||
    networks: | 
				
			||||
      net: | 
				
			||||
        ipv4_address: 10.103.204.1 | 
				
			||||
  backend1: | 
				
			||||
    build: | 
				
			||||
      dockerfile: ./Dockerfile.task1 | 
				
			||||
      context: ../../task1-backend | 
				
			||||
    restart: unless-stopped | 
				
			||||
    networks: | 
				
			||||
      net: {} | 
				
			||||
 | 
				
			||||
networks: | 
				
			||||
  net: | 
				
			||||
    external: | 
				
			||||
      name: tasks-net | 
				
			||||
					Loading…
					
					
				
		Reference in new issue