Skip to content

Commit 56451df

Browse files
author
ikepu-tp
committed
Add: docker-file
1 parent 790e4c3 commit 56451df

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/commands/init.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,31 @@ const gitignoreFileContent = `.remote
4545
node_modules
4646
`;
4747

48+
const dockerfilePath = path.join(rootDir, "Dockerfile");
49+
const dockerfileContent = `FROM node:20-alpine3.17
50+
51+
WORKDIR /qiita
52+
53+
EXPOSE 8888
54+
`;
55+
56+
const dockerComposeFilePath = path.join(rootDir, "docker-compose.yml");
57+
const dockerComposeFileContent = `version: "3"
58+
services:
59+
qiita:
60+
container_name: qiita
61+
build:
62+
context: .
63+
dockerfile: ./Dockerfile
64+
ports:
65+
- 8888:8888
66+
tty: true
67+
volumes:
68+
- ./:/qiita
69+
environment:
70+
TZ: Asia/Tokyo
71+
`;
72+
4873
export const init = async () => {
4974
console.log("設定ファイルを生成します。\n");
5075

@@ -54,6 +79,10 @@ export const init = async () => {
5479
writeFile(publishWorkflowFilePath, publishWorkflowFileContent);
5580
writeFile(gitignoreFilePath, gitignoreFileContent);
5681

82+
//docker
83+
writeFile(dockerfilePath, dockerfileContent);
84+
writeFile(dockerComposeFilePath, dockerComposeFileContent);
85+
5786
const userConfigFilePath = config.getUserConfigFilePath();
5887
const userConfigDir = config.getUserConfigDir();
5988
if (!fs.existsSync(userConfigFilePath)) {

0 commit comments

Comments
 (0)