0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GoのDocker開発環境を作る

Posted at

Goで開発環境を作る時Dockerを使っているのですが、いつもDockerfileやdocker-composeの内容を忘れてしまうので、メモしておく。

Dockerfile

#go version
FROM 1.20-alpine3.17

#update & install (vimやbashを入れとくと便利)
RUN apk add --update && apk add git && apk add vim && apk add bash

# 作業ディレクトリ作成
RUN mkdir /go/src/app

# 作業ディレクトリ設定
WOKRDIR /go/src/app

# ホットリロード用にairをインストール
RUN go install github.com/cosmtrek/air@latest

# airを実行
CMD ["air"]

docker-compose

version: '3.9'
services:
  backend:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ./app:/go/src/app
    ports:
      - '8000:8000'
    tty: true

これで最低限開発はできるはず。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?