duanlan6259 2018-09-03 19:07
浏览 656
已采纳

如何编写dockerfile从我的github正确提取代码

I'm working on building a website in Go, which is hosted on my home server via docker.

What I'm trying to do: I make changes to my website/server locally, then push them to github. I'd like to write a dockerfile such that it pulls this data from my github, builds the image, which my docker-compose file will then use to create the container.

Unfortunately, all of my attempts have been somewhat close but wrong.

FROM golang:1.8-onbuild
MAINTAINER <my info>
RUN go get <my github url>
ENV webserver_path /website/
ENV PATH $PATH: webserver_path
COPY website/ .
RUN go build .
ENTRYPOINT ./website
EXPOSE <ports>

This file is kind of a combination of a few small guides I found through google searches, but none quite gave me the information I needed and it never quite worked.

I'm hoping somebody with decent docker experience can just put a Dockerfile together for me to use as a guide so I can find what I'm doing wrong? I think what I'm looking for can be done in only a few lines, and mine is a little more verbose than needed.

ADDITIONAL BUT PROBABLY UNNECESSARY INFORMATION BELOW

Project layout:

enter image description here

Data: is where my go files are Sidenote: This was throwing me errors when trying to build image, something about not being in the environment path. Not sure if that is helpful

Static: CSS, JS, Images

TPL: go template files

Main.go: launches server/website

  • 写回答

3条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 Java的问题解答一下呗
      • ¥20 怎么将vs中的程序同步到sql中的表中
      • ¥15 用flask框架接收前端上传的文本文件后怎么读取该文件
      • ¥15 有没有嵌入式ubuntu的朋友
      • ¥50 diddler Burp Suite
      • ¥20 关于UE5.1的问题,求专家解答!
      • ¥30 关于#爬虫#的问题:百度为您找到相关结果约100,000,000个 但只展现70页 有没有可能提取出来全部的搜索结果
      • ¥40 IIS部署API,弄了几天没弄出来,希望带佬远程帮我弄一下,有偿
      • ¥15 关于#c##的问题:winform中利用delegate更新ui的顺序错误
      • ¥15 qt5.6.1读取oracle8中文数据乱码