Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerize the application #185

Closed
jonaustin09 opened this issue Aug 2, 2023 · 1 comment
Closed

Dockerize the application #185

jonaustin09 opened this issue Aug 2, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@jonaustin09
Copy link
Contributor

Describe the solution you'd like
Implement a docker-compose.yml file to run the build "app" service and run the application as a docker container. Set a volume host to the project root to map all the changes from the project to the docker container. Make sure the server is restarted inside the docker container on every file change.

@jonaustin09 jonaustin09 added the enhancement New feature or request label Aug 2, 2023
@alexlovelltroy
Copy link

alexlovelltroy commented Dec 6, 2023

I've worked with goreleaser a few times to publish docker containers as part of the release process. I didn't originally find it straightforward, but ultimately was satisfied with the results. The goreleaser philosophy does the full build once, outside the container and then expects to copy the binaries from an earlier step into the container. This negates the need for multi-stage builds and encourages consistency at the binary level. It also sets up the context for the docker build within the dist/ directory as appropriate for the architecture.

If useful, I can add this content to a PR or add more details.

Changes requried include two files. The first adds a dockers stanza to the .goreleaser.yaml file and a the second is a dedicated Dockerfile for the release. Here's an example of both:

goreleaser.yaml

dockers:
  - image_templates:
      - ghcr.io/versity/{{.ProjectName}}:latest
      - ghcr.io/versity/{{.ProjectName}}:{{ .Tag }}
      - ghcr.io/versity/{{.ProjectName}}:{{ .Major }}
      - ghcr.io/versity/{{.ProjectName}}:{{ .Major }}.{{ .Minor }}
    build_flag_templates:
      - "--pull"
      - "--label=org.opencontainers.image.created={{.Date}}"
      - "--label=org.opencontainers.image.title={{.ProjectName}}"
      - "--label=org.opencontainers.image.revision={{.FullCommit}}"
      - "--label=org.opencontainers.image.version={{.Version}}"
    extra_files:
      - LICENSE
      - README.md
    dockerfile: Dockerfile.goreleaser

Dockerfile.goreleaser

FROM cgr.dev/chainguard/wolfi-base
RUN apk add --no-cache tini bash

# These arguments can be overriden when building the image
ARG IAM_DIR=/tmp/vgw
ARG SETUP_DIR=/tmp/vgw

RUN mkdir -p $IAM_DIR
RUN mkdir -p $SETUP_DIR

# nobody 65534:65534
USER 65534:65534

VOLUME "/data"

EXPOSE 7070

COPY  versitygw  /versitygw

CMD [ "/versitygw", "posix",  "/data"]

ENTRYPOINT [ "/sbin/tini", "--" ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants