質問編集履歴

1

docker-compose.ymlとDockerfileを追加しました。

2019/10/01 00:39

投稿

kurukururin
kurukururin

スコア21

test CHANGED
File without changes
test CHANGED
@@ -73,3 +73,117 @@
73
73
 
74
74
 
75
75
  これはどういったことが原因で.dockerignoreの設定が反映されていないのでしょうか?
76
+
77
+
78
+
79
+ docker-compose.yml
80
+
81
+ ```
82
+
83
+ version: "3"
84
+
85
+ services:
86
+
87
+ backend:
88
+
89
+ build:
90
+
91
+ context: ./backend
92
+
93
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
94
+
95
+ volumes:
96
+
97
+ - ./backend:/myapp
98
+
99
+ - bundle:/usr/local/bundle
100
+
101
+ ports:
102
+
103
+ - "3000:3000"
104
+
105
+ links:
106
+
107
+ - db
108
+
109
+ db:
110
+
111
+ image: postgres:12
112
+
113
+ ports:
114
+
115
+ - "5432:5433"
116
+
117
+ volumes:
118
+
119
+ - postgresql-data:/var/lib/postgresql/data
120
+
121
+ frontend:
122
+
123
+ build:
124
+
125
+ context: ./frontend
126
+
127
+ volumes:
128
+
129
+ - ./frontend:/myapp
130
+
131
+ - /myapp/node_modules
132
+
133
+ ports:
134
+
135
+ - "8080:8080"
136
+
137
+ volumes:
138
+
139
+ postgresql-data:
140
+
141
+ driver: local
142
+
143
+ bundle:
144
+
145
+ driver: local
146
+
147
+ ```
148
+
149
+
150
+
151
+ Dockerfile
152
+
153
+ ```
154
+
155
+ FROM ruby:2.5.0
156
+
157
+ RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
158
+
159
+ RUN mkdir /myapp
160
+
161
+ WORKDIR /myapp
162
+
163
+
164
+
165
+ COPY entrypoint.sh /usr/bin/
166
+
167
+ RUN chmod +x /usr/bin/entrypoint.sh
168
+
169
+ ENTRYPOINT ["entrypoint.sh"]
170
+
171
+
172
+
173
+ COPY Gemfile /myapp/Gemfile
174
+
175
+ COPY Gemfile.lock /myapp/Gemfile.lock
176
+
177
+ RUN bundle install
178
+
179
+ COPY . /myapp
180
+
181
+
182
+
183
+ EXPOSE 3000
184
+
185
+
186
+
187
+ CMD ["rails", "server", "-b", "0.0.0.0"]
188
+
189
+ ```