Skip to content

Instantly share code, notes, and snippets.

@doziestar
Last active August 16, 2023 14:28
Show Gist options
  • Save doziestar/909a9d451e2e3a8f50737dca630fc7d3 to your computer and use it in GitHub Desktop.
Save doziestar/909a9d451e2e3a8f50737dca630fc7d3 to your computer and use it in GitHub Desktop.
tls: failed to verify certificate: x509: certificate signed by unknown authority
`docker-compose`
server:
container_name: hubhub-server
# image: '${DOCKER_USER}/hubhubserver:latest'
extra_hosts:
- host.docker.internal:host-gateway
restart: always
build:
context: .
dockerfile: ./compose/local/server/Dockerfile
env_file:
- /usr/bin/.env.staging
networks:
- proxy
- backend
volumes:
- server_logs:/var/log/server
- /usr/bin/.env.staging:/usr/bin/.env.staging
- /usr/bin/.env:/usr/bin/.env
labels:
- 'traefik.enable=true'
- 'traefik.docker.network=backend'
- 'traefik.http.routers.server-secure.entrypoints=websecure'
- 'traefik.http.routers.server-secure.rule=Host(`server.innate.io`)'
- 'traefik.http.services.server.loadbalancer.sticky.cookie=true'
- 'traefik.http.routers.server-secure.service=server'
- 'traefik.http.services.server.loadbalancer.server.port=8080'
- 'traefik.http.services.server.loadbalancer.healthcheck.path=/health'
- 'traefik.http.services.server.loadbalancer.healthcheck.interval=10s'
logging:
driver: 'json-file'
options:
max-size: '200k'
max-file: '10'
computations:
container_name: computations
restart: always
ports:
- "7001:7001"
extra_hosts:
- host.docker.internal:host-gateway
labels:
- 'traefik.enable=true'
- 'traefik.docker.network=backend'
- 'traefik.http.routers.computations-secure.entrypoints=websecure'
- 'traefik.http.routers.computations-secure.rule=Host(`computations.innate.io`)'
- 'traefik.http.services.computations.loadbalancer.sticky.cookie=true'
- 'traefik.http.routers.computations-secure.service=computations'
- 'traefik.http.services.computations.loadbalancer.server.port=7001'
# - 'traefik.http.services.computations.loadbalancer.healthcheck.path=/health'
# - 'traefik.http.services.computations.loadbalancer.healthcheck.interval=10s'
# image: '${DOCKER_USER}/hubhubcomputations:latest'
build:
context: .
dockerfile: ./compose/production/computations/Dockerfile
volumes:
- computations_logs:/var/log/computations
- /usr/bin/.env.staging:/usr/bin/.env.staging
- /usr/bin/.env:/usr/bin/.env
depends_on:
- server
networks:
- proxy
- backend
env_file:
- /usr/bin/.env.staging
logging:
driver: 'json-file'
options:
max-size: '200k'
max-file: '10'
traefik:
image: traefik:latest
extra_hosts:
- host.docker.internal:host-gateway
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
- backend
ports:
- 80:80
- 443:443
- "8090:8080"
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./compose/production/traefik/traefik.yml:/traefik.yml
# - ./compose/production/traefik/acme.json:/acme.json
- ./compose/production/traefik/configurations:/configurations
# - /opt/traefik/traefik.yml:/traefik.yml
- /opt/traefik/acme.json:/acme.json
# - /opt/traefik/dynamic.yml:/configurations/dynamic.yml
- traefik_logs:/var/log/traefik
labels:
- 'traefik.enable=true'
- 'traefik.docker.network=backend'
- 'traefik.http.routers.traefik-secure.entrypoints=websecure'
- 'traefik.http.routers.traefik-secure.rule=Host(`proxy.innate.io`)'
# - 'traefik.http.routers.traefik-secure.middlewares=user-auth@file'
- 'traefik.http.routers.traefik-secure.service=api@internal'
- '--metrics.prometheus=true'
- '--metrics.prometheus.buckets=0.1,0.3,1.2,5.0'
# - 'traefik.http.routers.traefik-secure.middlewares=ratelimit@file'
# - 'traefik.http.routers.traefik-secure.middlewares=gzip@file'
logging:
driver: 'json-file'
options:
max-size: '200k'
max-file: '10'
Dockerfile:
# Define the base image with a version argument
ARG GOLANG_VERSION=1.20-alpine
FROM golang:${GOLANG_VERSION} AS builder
WORKDIR /app
# Install system packages and utilities
RUN apk add --no-cache \
git make gcc musl-dev linux-headers ca-certificates bash curl jq && \
update-ca-certificates && \
# Add the edge repos for the latest packages
echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
# Install Chromium
apk update && apk upgrade && apk add --no-cache ca-certificates ttf-dejavu chromium
# Copy Go module files and download dependencies
COPY ./computations/go.* ./
RUN go mod download
# Copy the rest of the application files
COPY ./computations .
ENV GIN_MODE=release
# Build the Go application
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o /bin/computations
# Final stage to run the application
FROM scratch
# Copy the built binary from the builder stage
COPY --from=builder /bin/computations /bin/computations
CMD ["/bin/computations"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment