From 449b455d2405d5843ceb381cd18cca2d42db3da5 Mon Sep 17 00:00:00 2001 From: minoplhy Date: Thu, 11 Apr 2024 16:37:01 +0700 Subject: [PATCH] fix: Dockerfile --- Dockerfile | 22 +++++++++++++++++++--- docker-compose.build.yml | 12 ++++++++++++ docker-compose.example.yml | 2 +- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 docker-compose.build.yml diff --git a/Dockerfile b/Dockerfile index 5040ac6..0081924 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,27 @@ +# syntax=docker/dockerfile:1 + FROM golang:latest +# Set destination for COPY WORKDIR /app -COPY . . - +# Download Go modules +COPY go.mod go.sum ./ RUN go mod download +# Copy the source code. Note the slash at the end, as explained in +# https://docs.docker.com/reference/dockerfile/#copy +COPY . . + +# Build +RUN go build -o /chibisafe_proxy + +# Optional: +# To bind to a TCP port, runtime parameters must be supplied to the docker command. +# But we can document in the Dockerfile what ports +# the application is going to listen on by default. +# https://docs.docker.com/reference/dockerfile/#expose EXPOSE 4040 -CMD ["go", "run", "main.go"] +# Run +CMD ["/chibisafe_proxy"] \ No newline at end of file diff --git a/docker-compose.build.yml b/docker-compose.build.yml new file mode 100644 index 0000000..d6ee74e --- /dev/null +++ b/docker-compose.build.yml @@ -0,0 +1,12 @@ +version: '3.8' + +services: + app: + build: . + ports: + - "4040:4040" + volumes: + - .:/app + environment: + - CHIBISAFE_BASEPATH= + - MAX_UPLOAD_SIZE= diff --git a/docker-compose.example.yml b/docker-compose.example.yml index d6ee74e..8f1f4fb 100644 --- a/docker-compose.example.yml +++ b/docker-compose.example.yml @@ -2,7 +2,7 @@ version: '3.8' services: app: - build: . + image: ghcr.io/minoplhy/chibisafe-netproxy:latest ports: - "4040:4040" volumes: